SegDecomp-class: Class Decomp

Description Objects from the Class Slots Methods Author(s) See Also Examples

Description

A class to hold results from deseg.

Objects from the Class

Objects can be created by calls to deseg, or the constructor SegDecomp.

Slots

d

a numeric vector of length three, representing the locational, compositional, and qualitative segregation, respectively.

coords

a numeric matrix or data frame with coordinates (each row is a point).

data

an object of class matrix containing the population data at each data point. The number of rows in ‘data’ should equal the number of points in ‘coords’, and the number of columns should be greater than one (i.e., at least two population groups are required).

proj4string

an optional projection string of class CRS.

Methods

coerce

signature(from = "SegDecomp", to = "SpatialPoints"): coerce an object of class SegDecomp to an object of class SpatialPoints. The points have no attribute data.

coerce

signature(from = "SegDecomp", to = "SpatialPointsDataFrame"): coerce an object of class SegDecomp to an object of class SpatialPointsDataFrame. The values in the slot ‘data’ will be used as the attribute data.

coerce

signature(from = "SegDecomp", to = "SpatialPixelsDataFrame"): coerce an object of class SegDecomp to an object of class SpatialPixelsDataFrame. This method is to retrieve the kernel density estimates and save it as a SpatialPixelsDataFrame object, with a proj4string.

coerce

signature(from = "SegDecomp", to = "vector"): coerce an object of class SegDecomp to an object of class vector. Use this to extract the segregation index values from the specified object.

as.list

signature(x = "SegDecomp"): same as the above.

show

signature(object = "SegDecomp"): print the segregation index values.

print

signature(x = "SegDecomp"): same as show.

spplot

signature(obj = "SegDecomp"): coerce an object of class SegDecomp to an object of class SpatialPixelsDataFrame or SpatialPointsDataFrame and display it. See help(spplot) for more details about the graphical parameter arguments.

Author(s)

Seong-Yun Hong

See Also

SegDecomp, deseg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# creates 100 regularly-spaced data points and 3 population groups
xy <- expand.grid(1:10, 1:10)
colnames(xy) <- c("x", "y")
pop <- matrix(runif(300), ncol = 3)
colnames(pop) <- LETTERS[1:3]

# randomly-generated index values
d <- runif(2, 0, 0.4)
d <- c(d, 0.9 - sum(d))

# constructs an object of class 'SegDecomp'
v <- SegDecomp(d = d, coords = as.matrix(xy), data = pop)
print(v)

# retrieves the index values
as.vector(v) # same as: as(v, "vector")

# displays the kernel estimates in the slot 'data'
spplot(v, col.regions = heat.colors(20))

seg documentation built on Dec. 19, 2019, 1:09 a.m.