Learn R Programming

sensors4plumes (version 0.9.3)

subsetSDF: Subsetting objects of class SpatialDataFrame

Description

Subsetting of objects of class SpatialDataFrame: selects according to the spatial objects or to the attribute(s), and returns an object of the same class.

Usage

subsetSDF(x, locations, data = names(x@data), ...)

Arguments

x

object of class SpatialDataFrame

locations

integer vector: keep object at these spatial locations

data

integer vector or names of columns of the x@data to be kept

...

further arguments to be passed to other methods

Value

An object of the same SpatialDataFrame class.

Examples

Run this code
# NOT RUN {
data(SIndexDF)
data(SPointsDF)
data(SPixelsDF)
data(SPolygridDF)
data(SPolygonsDF)
data(SLinesDF)

sub_Index = subsetSDF(SIndexDF, locations = c(1,3), data = "c")
sub_Points = subsetSDF(SPointsDF, locations = c(1,3), data = "z")
sub_Pixels = subsetSDF(SPixelsDF, locations = c(1,3), data = "z")
sub_Polygrid = subsetSDF(SPolygridDF, locations = c(1,3), data = "b")
sub_Polygons = subsetSDF(SPolygonsDF, locations = c(1,3), data = "a")
sub_Lines = subsetSDF(SLinesDF, locations = 1:2, data = "a")

# }

Run the code above in your browser using DataLab