Debian Codegraph @

man/SpatialMultiPoints.Rd

raw
1 \name{SpatialMultiPoints}
2 \alias{SpatialMultiPoints}
3 \alias{SpatialMultiPointsDataFrame}
4 \title{ create objects of class SpatialMultiPoints or SpatialMultiPointsDataFrame}
5 \description{ create objects of class \link{SpatialMultiPoints-class} or
6 \link{SpatialMultiPointsDataFrame-class} from
7 coordinates, and from coordinates and \code{data.frame}s}
8 \usage{
9 SpatialMultiPoints(coords, proj4string=CRS(as.character(NA)), bbox = NULL)
10 SpatialMultiPointsDataFrame(coords, data,
11 proj4string = CRS(as.character(NA)), match.ID, bbox = NULL)
12 }
13 \arguments{
14 \item{coords}{list with in each element a numeric matrix or data.frame with coordinates
15 (each row representing a point); in case of SpatialMultiPointsDataFrame an object
16 of class \link{SpatialMultiPoints-class} is also allowed}
17 \item{proj4string}{ projection string of class \link{CRS-class}}
18 \item{bbox}{bounding box matrix, usually NULL and constructed from the data, but may be passed through for coercion purposes if clearly needed}
19 \item{data}{ object of class \code{data.frame}; the number of rows in \code{data}
20 should equal the number of points in the \code{coords} object}
21 \item{match.ID}{ logical or character; if missing, and \code{coords} and \code{data} both have
22 row names, and their order does not correspond, matching is done by these
23 row names and a warning is issued; this warning can be suppressed by setting
24 \code{match.ID} to TRUE.
25 If TRUE AND coords has non-automatic
26 rownames (i.e., coerced to a matrix by \code{as.matrix},
27 \code{dimnames(coords)[[1]]} is not \code{NULL}), AND \code{data} has
28 row.names (i.e. is a data.frame), then the \code{SpatialMultiPointsDataFrame}
29 object is formed by matching the row names of both components, leaving
30 the order of the coordinates in tact. Checks are done to see whether
31 both row names are sufficiently unique, and all data are matched.
32 If FALSE, coordinates and data are simply "glued" together, ignoring row names. If
33 character: indicates the column in \code{data} with coordinates IDs
34 to use for matching records. See examples below. }
35 }
36 \value{
37 \code{SpatialMultiPoints} returns an object of class \code{SpatialMultiPoints};
38 \code{SpatialMultiPointsDataFrame} returns an object of class \code{SpatialMultiPointsDataFrame};
39 }
40 \seealso{ \link{coordinates}, \link{SpatialMultiPoints-class},
41 \link{SpatialMultiPointsDataFrame-class} }
42 \examples{
43 cl1 = cbind(rnorm(3, 10), rnorm(3, 10))
44 cl2 = cbind(rnorm(5, 10), rnorm(5, 0))
45 cl3 = cbind(rnorm(7, 0), rnorm(7, 10))
46
47 mp = SpatialMultiPoints(list(cl1, cl2, cl3))
48 mpx = rbind(mp, mp) # rbind method
49 plot(mp, col = 2, cex = 1, pch = 1:3)
50 mp
51 mp[1:2]
52
53 print(mp, asWKT=TRUE, digits=3)
54
55 mpdf = SpatialMultiPointsDataFrame(list(cl1, cl2, cl3), data.frame(a = 1:3))
56 mpdf
57 mpdfx = rbind(mpdf, mpdf) # rbind method
58
59 plot(mpdf, col = mpdf$a, cex = 1:3)
60 as(mpdf, "data.frame")
61 mpdf[1:2,]
62 }
63 \keyword{manip}