# center_mean: Calculate Center Mean Point In sfdep: Spatial Dependence for Simple Features

 center_mean R Documentation

## Calculate Center Mean Point

### Description

Given an sfc object containing points, calculate a measure of central tendency.

### Usage

```center_mean(geometry, weights = NULL)

center_median(geometry)

euclidean_median(geometry, tolerance = 1e-09)
```

### Arguments

 `geometry` an sfc object. If a polygon, uses `sf::st_point_on_surface()`. `weights` an optional vector of weights to apply to the coordinates before calculation. `tolerance` a tolerance level to terminate the process. This is passed to `pracma::geo_median()`.

### Details

• `center_mean()` calculates the mean center of a point pattern

• `euclidean_median()` calculates the euclidean median center of a point pattern using the `pracma` package

• `center_median()` calculates the median center it is recommended to use the euclidean median over the this function.

### Value

an sfc POINT object

Other point-pattern: `std_distance()`

Other point-pattern: `std_distance()`

### Examples

```# Make a grid to sample from
grd <- sf::st_make_grid(n = c(1, 1), cellsize = c(100, 100), offset = c(0,0))

# sample 100 points
pnts <- sf::st_sample(grd, 100)

cm <- center_mean(pnts)
em <- euclidean_median(pnts)
cmed <- center_median(pnts)

plot(pnts)
plot(cm, col = "red", add = TRUE)
plot(em, col = "blue", add = TRUE)
plot(cmed, col = "green", add = TRUE)
```

sfdep documentation built on Jan. 11, 2023, 9:08 a.m.