SegLocal-class: Class SegLocal

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

Description

A class to hold the local population composition data.

Objects from the Class

Objects can be created by calls to localenv, or the constructor SegLocal.

Slots

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).

env

an object of class matrix containing the local environment parameters. Must be the same dimensions as ‘data’.

proj4string

an optional projection string of class CRS.

Methods

coerce

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

coerce

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

coerce

signature(from = "SegLocal", to = "SpatialPixelsDataFrame"): coerce an object of class SegLocal to an object of class SpatialPixelsDataFrame. The values in the slot ‘env’ will be used as the attribute data. May not work when the points are irregularly spaced.

coerce

signature(from = "SpatialPointsDataFrame", to = "SegLocal"): coerce an object of class SpatialPointsDataFrame to an object of class SegLocal.

coerce

signature(from = "SpatialPolygonsDataFrame", to = "SegLocal"): coerce an object of class SpatialPolygonsDataFrame to an object of class SegLocal.

show

signature(object = "SegLocal"): show the number of points and data columns in an object of class SegLocal.

print

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

plot

signature(x = "SegLocal"): draw a plot, or plots, of points in an object of class SegLocal. Use an optional argument ‘which.col’ to specify a column of the data that determines the points' sizes. See the examples below for demonstration.

points

signature(x = "SegLocal"): draw points in an object of class SegLocal on an active graphic device.

spplot

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

summary

signature(object = "SegLocal"): summarise the population compositions of points and local environments in an object of class SegLocal.

update

signature(object = "SegLocal"): update an existing object of class SegLocal.

Author(s)

Seong-Yun Hong

See Also

SegLocal, localenv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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]

# constructs an object of class 'SegLocal'
v <- SegLocal(coords = as.matrix(xy), data = pop, env = pop)
summary(v)

# updates the map projection information
v <- update(v, proj4string = CRS("+proj=nzmg +datum=nzgd49"))
summary(v)

# displays the (randomly-generated) local population data
par(mfrow = c(1, 3))
plot(v, main = paste("Data", colnames(pop)), xlab = "x", ylab = "y")
par(mfrow = c(1, 1))

# coverts the object to class 'Spatial'
plot(as(v, "SpatialPoints"))
spplot(v, col.regions = heat.colors(20))
v.sp <- as(v, "SpatialPixelsDataFrame")
is(v.sp)

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