Description Usage Arguments Details Value Note Author(s) See Also Examples

Compute the mean centre from a series of point locations.

1 2 | ```
mean_centre(id=1, filename="mean_centre_Output.txt",
weighted=FALSE, weights=NULL, points=activities)
``` |

`id` |
A unique integer to identify the mean centre |

`filename` |
A string indicating the ASCII textfile where centre coordinates will be written |

`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 |

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

The result is a list of terms:

`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

1 2 3 4 5 6 7 | ```
## Mean centre example
mean_centre(id=1, filename="mean_centre_Output.txt",
weighted=FALSE, weights=NULL, points=activities)
## Mean centre to shapefile example (exclude the comments below to run script)
## shp <- convert.to.shapefile(meanloc,meanatt,"id",5)
## write.shapefile(shp, "Mean_Shape", arcgis=T)
``` |

```
Loading required package: splancs
Loading required package: sp
Spatial Point Pattern Analysis Code in S-Plus
Version 2 - Spatial and Space-Time analysis
Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2
Attaching package: 'Hmisc'
The following object is masked from 'package:splancs':
zoom
The following objects are masked from 'package:base':
format.pval, units
Loading required package: shapefiles
Loading required package: foreign
Attaching package: 'shapefiles'
The following objects are masked from 'package:foreign':
read.dbf, write.dbf
id CENTRE.x CENTRE.y
1 1 610941.3 4830837
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.