| 1 |
\name{SpatialPointsDataFrame-class} |
| 2 |
\docType{class} |
| 3 |
\alias{SpatialPointsDataFrame-class} |
| 4 |
\alias{[,SpatialPointsDataFrame-method} |
| 5 |
\alias{coerce,SpatialPointsDataFrame,data.frame-method} |
| 6 |
\alias{coerce,SpatialPointsDataFrame,SpatialPoints-method} |
| 7 |
\alias{show,SpatialPointsDataFrame-method} |
| 8 |
\alias{points,SpatialPointsDataFrame-method} |
| 9 |
\alias{coordinates,SpatialPointsDataFrame-method} |
| 10 |
\alias{as.data.frame.SpatialPointsDataFrame} |
| 11 |
\alias{dim.SpatialPointsDataFrame} |
| 12 |
\alias{print.SpatialPointsDataFrame} |
| 13 |
\alias{ShowSpatialPointsDataFrame} |
| 14 |
\alias{as.SpatialPoints.SpatialPointsDataFrame} |
| 15 |
\alias{rbind.SpatialPointsDataFrame} |
| 16 |
\alias{row.names.SpatialPointsDataFrame} |
| 17 |
\alias{coerce,ppp,SpatialPointsDataFrame-method} |
| 18 |
|
| 19 |
\title{Class "SpatialPointsDataFrame" } |
| 20 |
\description{ Class for spatial attributes that have spatial point locations } |
| 21 |
\section{Objects from the Class}{ |
| 22 |
Objects can be created by calls of the form \code{coordinates(x) = c("x", "y") }. |
| 23 |
or of the form \code{coordinates(x) = xy}; see \link{coordinates}. |
| 24 |
} |
| 25 |
\section{Slots}{ |
| 26 |
\describe{ |
| 27 |
\item{\code{data}:}{Object of class data.frame containing |
| 28 |
the attribute data (may or may not contain the coordinates in its columns) } |
| 29 |
\item{\code{coords}:}{Object of class \code{"matrix"}; the coordinates matrix |
| 30 |
(points are rows in the matrix) } |
| 31 |
\item{\code{coords.nrs}}{Object of class logical; if TRUE, when |
| 32 |
the object was created the coordinates were retrieved from the data.frame, |
| 33 |
and hence stripped from it; after coercion to data.frame, e.g. by |
| 34 |
as.data.frame(x), coordinates will again be added (as first few columns) |
| 35 |
to the data.frame } |
| 36 |
\item{\code{bbox}:}{Object of class \code{"matrix"}; bounding box} |
| 37 |
\item{\code{proj4string}:}{Object of class \code{"CRS"}; projection string} |
| 38 |
} |
| 39 |
} |
| 40 |
\section{Extends}{ |
| 41 |
Class \code{"SpatialPoints"}, directly. |
| 42 |
Class \code{"Spatial"}, by class \code{"SpatialPoints"}. |
| 43 |
} |
| 44 |
\usage{ |
| 45 |
\S4method{[}{SpatialPointsDataFrame}(x, i, j, ..., drop = TRUE) |
| 46 |
\S4method{coerce}{SpatialPointsDataFrame,SpatialPoints}(from, to, strict=TRUE) |
| 47 |
\S4method{coerce}{SpatialPointsDataFrame,data.frame}(from, to, strict=TRUE) |
| 48 |
\S4method{coordinates}{SpatialPointsDataFrame}(obj) |
| 49 |
\S4method{show}{SpatialPointsDataFrame}(object) |
| 50 |
\S4method{points}{SpatialPointsDataFrame}(x) |
| 51 |
\method{rbind}{SpatialPointsDataFrame}(...) |
| 52 |
} |
| 53 |
\arguments{ |
| 54 |
\item{x,from,obj,object}{\code{SpatialPointsDataFrame} object} |
| 55 |
\item{to}{class to which to coerce} |
| 56 |
\item{strict}{see \code{\link[methods]{as}}} |
| 57 |
\item{i}{row indices} |
| 58 |
\item{j}{column indices} |
| 59 |
\item{drop}{see \code{\link[base]{Extract}}} |
| 60 |
\item{...}{indices passed through} |
| 61 |
} |
| 62 |
\author{ Edzer Pebesma, \email{[email protected]} } |
| 63 |
|
| 64 |
\seealso{ |
| 65 |
\code{\link{coordinates}}, \code{\link{SpatialPoints-class}} |
| 66 |
} |
| 67 |
\examples{ |
| 68 |
data(meuse) |
| 69 |
xy = meuse[c("x", "y")] # retrieve coordinates as data.frame |
| 70 |
class(meuse) |
| 71 |
data(meuse) # reload data.frame |
| 72 |
coordinates(meuse) = c("x", "y") # specify column names |
| 73 |
class(meuse) |
| 74 |
data(meuse) # reload data.frame |
| 75 |
coordinates(meuse) = c(1, 2) # specify column names |
| 76 |
class(meuse) |
| 77 |
data(meuse) # reload data.frame |
| 78 |
coordinates(meuse) = ~x+y # formula |
| 79 |
class(meuse) |
| 80 |
data(meuse) # reload data.frame |
| 81 |
coordinates(meuse) = xy # as data frame |
| 82 |
class(meuse) |
| 83 |
data(meuse) # reload data.frame |
| 84 |
coordinates(meuse) = as.matrix(xy) # as matrix |
| 85 |
meuse$log.zn = log(meuse$zinc) |
| 86 |
class(meuse) |
| 87 |
dim(meuse) |
| 88 |
} |
| 89 |
\keyword{classes} |