Description Usage Arguments Details Value Methods (by class) Column specification
Generic function that, given a set of pionts, finds their centroid.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
x |
matrix or data frame with observations in rows and dimensions in columns |
... |
for data frame method, columns that store cooridinates |
Centroid coordinates are derived as average coordinates of all points in respective dimensions. If a point is missing a coordinate, the remainig dimensions are still considered. Methods exist for matrix and data frame.
The data frame method isolates relevant columns as a matrix and calls the matrix method.
numeric vector of centroid coordinates
numeric
: simply returns the mean, NAs are omitted
matrix
: simply averages columns, omitting NAs
data.frame
: extracts the requested columns and converts them to a matrix and then calls the matrix method
grouped_df
: see data.frame__to__grouped_df
Matrices are accepted as is, all columns are considered.
If x
is a data frame, columns that carry coordinates may be specified.
They can be given as strings, bare names or numerical indices but
they must all be specified in the same way.
Also, each column must be specified separately, vectors are not accepted.
If no columns are specified, all numeric ones are considered.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.