ArmorCode ArmorCode - 1 year ago 76
R Question

Mean of 2-dimensional data points

I have these data points:

> a1 = c(2,10)
> a2 = c(2,5)
> a3 = c(8,4)

And I'd like to find the 2 dimensional mean (edit: Centroid) of those data points with r.

I have tried the following:


but it only gives me a one-dimensional mean value. How can I get the mean of the points?

Answer Source

If you have 3 points always-

centroid <- (a1 + a2 + a3) / 3
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download