Given a set of x-y (or longitude-latitude) coordinates, this function computes their distance to the centroid of the set.
dist2centroid(x, y, geo = FALSE)
A vector of x (or longitude) coordinates.
A vector of y (or latitude) coordinates.
A logical value indicating whether the locations are defined by geographic coordinates (pairs of longitude/latitude values). Default: FALSE.
A vector of the same length as x and y corresponding to the individual distance of each point to the centroid of the set.