calc_mnc | R Documentation |
Compute the mean centre from a series of point locations.
calc_mnc(id=1, weighted=FALSE, weights=NULL,
points=NULL, verbose=FALSE)
id |
A unique integer to identify the mean centre |
weighted |
Boolean: Set to TRUE if the weighted mean center is to be computed with weighted coordinates |
weights |
Weights applied to point observations, number of weights should equal the number of observations |
points |
A 2-column matrix or data frame containing the set of point observations |
verbose |
A Boolean flag that controls verbose feedback to the monitor |
Use the meanloc (coordinates) and meanatt(attributes) to produce shapefiles using the convert.to.shapefile and write.shapefile from the shapefiles library
The returned result is a list:
TYPE |
The type of calculation results stored in the object: BOX, SDD, SDE, CMD, CF, or CF2PTS, MNC, MDC |
DATE |
The date and time that the function was run |
ID |
Identifier for the mean centre - it should be unique |
LOCATIONS |
Locations pertinent for the MNC that can be used with ATTRIBUTES if wishing to build a vector point file for geographic data outside of this pacakge. |
FORPLOTTING |
Coordinates and identifiers used for plotting. |
ATTRIBUTES |
Attributes for the output MNC that can be used with LOCATIONS coordinates if wishing to build a vector point file for geographic data outside of this package. |
id |
Identifier for the mean centre - it should be unique |
weighted |
Boolean: TRUE if the weighted mean centre is to be used instead |
weights |
Weights applied to point observations |
CENTRE.x |
X-coordinate of the mean centre |
CENTRE.y |
Y-coordinate of the mean centre |
Results are stored in the r.mean object and can be passed through plotting functions. This function can also be used repetitively within a loop to compute multiple mean centres from different datasets.
Randy Bui, Ron Buliung
calc_box
,
calc_sdd
,
calc_sde
,
calc_cmd
,
calc_cf
,
calc_cf2pts
,
calc_mdc
# MEAN CENTRE EXAMPLE
a <- calc_mnc(id=1, points=activities)
str(a)
print(a)
# MEAN CENTRE TO SHAPEFILE EXAMPLE (REMOVE THE COMMENTS TO RUN)
# shp <- convert.to.shapefile(a$LOCATIONS, a$ATTRIBUTES, "id", 5)
# write.shapefile(shp, "Mean_Shape", arcgis=T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.