Description Usage Arguments Details Value Author(s) Examples
COGravity
calculates the Centre of Gravity (or also
known as Centre of Mass) for point or raster spatial
data.
Note: NA data is automatically ommitted
from analysis.
1 |
x |
a vector of e.g., longitudes or eastings, or a raster of class 'asc', 'RasterLayer' or 'SpatialGridDataFrame'. |
y |
a vector of e.g., latitudes or northings. |
z |
a vector of e.g., elevations. |
wt |
a vector or raster of class 'asc', 'RasterLayer' or 'SpatialGridDataFrame' representing weights for data. |
For raster-based data, if wt
is missing, the values
of the ascii are assumed to be the weights; otherwise, the
values are assumed to be the z
values.
Returns a named vector of data representing the Centre of Gravity in x, y & z dimensions (depending on data supplied).
Jeremy VanDerWal jjvanderwal@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #create some points
x = seq(154,110,length=25)
y = seq(-10,-54,length=25)
z = seq(100,200,length=25)
wt = runif(25) #random weights
#calculate the Centre of Gravity for these points
COGravity(x,y,z,wt)
#create a simple objects of class 'asc'
x = as.asc(matrix(1:50,nr=50,nc=50))
wt = as.asc(matrix(runif(50),nr=50,nc=50))
#calculate COG with weighting defined in x
COGravity(x)
#calculate COG with weighting defined in wt (values in x are assumed elevation (z))
COGravity(x,wt=wt)
|
COGx COGx.sd COGy COGy.sd COGz COGz.sd
131.97555 12.34252 -32.02445 12.34252 150.05557 28.05119
COGx COGx.sd COGy COGy.sd
33.66667 11.90086 25.50000 14.43468
COGx COGx.sd COGy COGy.sd COGz COGz.sd
25.68429 14.14531 25.50000 14.43505 25.68429 14.14531
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.