Description Usage Arguments Details Value Control arguments Author(s) References Examples
This function obtains the m-surroundings by selecting the m-1 nearest neighbors of each observation, allowing for a degree of overlap of r.
1 | m.surround(x, m, r = 1, distance = "Euclidean", control = list())
|
x |
input sf object with points/multipolygons geometry or matrix of spatial coordinates |
m |
dimension of m-surrounding |
r |
maximum overlapping between any two m-surroundings. |
distance |
character. For Cartesian coordinates only: one of Euclidean, Hausdorff or Frechet; for geodetic coordinates, Great Circle distances are computed. |
control |
optional. Parameters for pruning m-surroundings with the aim of remove m-surroundings whose elements are too far. |
Aquí Antonio escribe una linda historia ...
A list of class list
and m_surr
containing the following components:
ms | a matrix. Each row is a m-surrounding. |
R | total number of observations. |
mdtms | xxxxxxxxxxxxxxxxxxx. |
mscbl | xxxxxxxxxxxxxxxxxxx. |
rowexcl | xxxxxxxxxxxxxxxxxxx. |
N | total number of symbolized observations. |
m | length of the m-surroundings. |
r | overlapping degree. |
initobs | element to star the generation of m-surroundings. default initobs=1. |
distance | distance select to prune the m-surroundings. |
m | length of the m-surroundings. |
x | the input "x" as sf-object. |
character to select the type of distance. Default = "Euclidean" for Cartesian coordinates only: one of Euclidean, Hausdorff or Frechet; for geodetic coordinates, great circle distances are computed (see sf::st_distance())
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Elimina m-surrounding donde alguno de los elementos no está entre los knn más próximos
Fernando López | fernando.lopez@upct.es |
Román Mínguez | roman.minguez@uclm.es |
Antonio Páez | paezha@gmail.com |
Manuel Ruiz | manuel.ruiz@upct.es |
Ruiz M, López FA, A Páez. (2010). Testing for spatial association of qualitative data using symbolic dynamics. Journal of Geographical Systems. 12 (3) 281-309
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | Example 1: Obtain m-surroundings with degree of overlapping r
rm(list = ls())
N <- 100
cx <- runif(N)
cy <- runif(N)
x <- cbind(cx,cy)
m = 3
r = 1
msurr_points <- m.surround(x = x, m = m, r = r)
plot(msurr_points, type = 1)
plot(msurr_points, type = 2)
summary(msurr_points)
msurr_points <- m.surround(x = x, m = m, r = r,control = list(dtmaxpc = 0.1))
plot(msurr_points, type = 1)
plot(msurr_points, type = 2)
summary(msurr_points)
msurr_points <- m.surround(x = x, m = m, r = r,control = list(dtmaxknn = 20))
plot(msurr_points, type = 1)
plot(msurr_points, type = 2)
summary(msurr_points)
Example 2:
rm(list = ls())
data("FastFood")
m = 3
r = 1
msurr_points <- m.surround(x = FastFood.sf, m = m, r = r, distance = "Euclidean", control = list(dtmaxpc = .1))
plot(msurr_points, type = 1)
plot(msurr_points, type = 2)
print(msurr_points)
summary(msurr_points)
msurr_points <- m.surround(x = FastFood.sf, m = m, r = r, distance = "Euclidean", control = list(dtmaxknn = 20))
plot(msurr_points, type = 1)
plot(msurr_points, type = 2)
summary(msurr_points)
Example 3: With isolated areas
rm(list = ls())
data(Spain)
plot(sf::st_geometry(spain.sf))
m = 3
r = 1
msurr_points <- m.surround(x = spain.sf, m = m, r = r, distance = "Euclidean", control = list(dtmaxknn = 8))
plot(msurr_points, type = 1)
plot(msurr_points, type = 2)
Example 4: Examples with multipolygons
rm(list = ls())
fname <- system.file("shape/nc.shp", package="sf")
nc <- st_read(fname)
plot(sf::st_geometry(nc))
m = 3
r = 1
msurr_polygonsf <- m.surround(x = nc, m = m, r = r,distance = "Great Circle", control=list(dtmaxpc = 0.20))
plot(msurr_polygonsf, type = 1)
plot(msurr_polygonsf, type = 2)
Example 5: With regular lattice
rm(list = ls())
sfc = st_sfc(st_polygon(list(rbind(c(0,0), c(1,0), c(1,1), c(0,1), c(0,0)))))
hexs <- st_make_grid(sfc, cellsize = 0.1, square = FALSE)
hexs.sf <- st_sf(hexs)
listw <- poly2nb(as(hexs.sf, "Spatial"), queen = FALSE)
m = 3
r = 1
msurr_polygonsf <- m.surround(x = hexs.sf, m = m, r = r)
plot(msurr_polygonsf, type = 1)
plot(msurr_polygonsf, type = 2)
summary(msurr_polygonsf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.