The spatial proximity index, SP, compares the clustering level (mean proximity) of a group compared to another group. The function can be used in two ways: to provide a distance matrix or a external geographic information source (spatial object or shape file).

1 2 |

`x` |
- an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a population group, within spatial units. The number of columns should be greater than 1 (at least 2 population groups are required). You should not include a column with total population in each unit, because this will be interpreted as a group. |

`d` |
- a matrix of the distances between spatial unit centroids |

`fdist` |
- the method used for distance interaction matrix: e' for inverse exponential function (by default) and 'l' for linear. |

`distin` |
- input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc. |

`distout` |
- output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc. |

`diagval` |
- when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial units area) (White, 1983) |

`itype` |
- a character string defining the index type: itype = 'multi' (by default) for the multigroup index (White, 1986) itype = 'between' for the between groups version (White, 1983) or itype = 'one' for the one-group version (Apparicio et al, 2008) |

`spatobj` |
- a spatial object (SpatialPolygonsDataFrame) containing geographic information |

`folder` |
- a character vector with the folder (directory) name indicating where the shapefile with the geographic information is located. |

`shape` |
- a character vector with the name of the shapefile (without the .shp extension) which contains the geographic information |

a matrix containing spatial proximity index values for each pair of groups

White M. J. (1983) *The Measurement of Spatial
Segregation*. American Journal of Sociology, 88, p. 1008-1019.

White, M. J. (1986) *Segregation and Diversity Measures
in Population Distribution*E. Population Index 52(2): 198-221.

Apparicio, P., V. Petkevitch and M. Charron (2008): *Segregation
Analyzer: A C#.Net application for calculating residential segregation indices*,
Cybergeo: European Journal of Geography, 414, 1-27.

Proximity measures: `Pxx`

,
`Pxy`

, `Poo`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
x <- segdata@data[ ,1:2]
ar<-area(segdata)
dist <- distance(segdata)
diag(dist)<-sqrt(ar) * 0.6
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'
SP(x, spatobj = segdata)
SP(x, folder = foldername, shape = shapename, fdist = 'l', itype = 'between')
SP(x, spatobj = segdata, diagval ='a', itype = 'one')
SP(x, d = dist, fdist = 'e')
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.