Learn R Programming

aspace (version 3.2)

median_centre: Median Centre Calculator

Description

Compute the median centre from a series of point locations.

Usage

median_centre(id=1, filename="median_centre_Output.txt", points=activities)

Arguments

id
A unique integer to identify the median centre
filename
A string indicating the ASCII textfile where centre coordinates will be written
points
A 2-column matrix or data frame containing the set of point observations

Value

The result is a list of terms:
id
Identifier for the median centre - it should be unique
median.x
X-coordinate of the median centre
median.y
Y-coordinate of the median centre

Details

Use the medianloc (coordinates) and medianatt(attributes) to produce shapefiles using the convert.to.shapefile and write.shapefile from the shapefiles library

See Also

mean_centre, CMD, CF

Examples

Run this code
## Median centre example
median_centre(id=1, filename="median_centre_Output.txt", 
points=activities)

## Median centre to shapefile example (exclude the comments below to run script)
## shp <- convert.to.shapefile(medianloc,medianatt,"id",5)
## write.shapefile(shp, "Median_Shape", arcgis=T)

Run the code above in your browser using DataLab