sdraw: Sample draws from spatial objects.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/sdraw.r

Description

Draw samples (point locations) from SpatialPoints, SpatialLines, SpatialPolygons, and the *DataFrame varieties of each.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S3 method for class 'SpatialPoints'
sdraw(x, n, type, ...)

## S3 method for class 'SpatialLines'
sdraw(x, n, type, ...)

## S3 method for class 'SpatialPolygons'
sdraw(x, n, type, ...)

sdraw(x, n, type = "BAS", ...)

Arguments

x

A spatial object. Methods are implemented for SpatialPoints, SpatialPointsDataFrame, SpatialLines, SpatialLinesDataFrame, SpatialPolygons, and SpatialPolygonsDataFrame objects.

n

Desired sample size. Some type's of samples are fixed-size (see DETAILS), in which case exactly n points are returned. Other type's are variable-size, and this number is the expected sample size (i.e., average over many repetitions).

type

Character, naming the type of sample to draw. Valid type's are:

  • "HAL" : HAlton Lattice sampling (Robertson et al., (Forthcoming))

  • "BAS" : Balanced Acceptance Sampling (Robertson et al., 2013)

  • "SSS" : Simple Systematic (grid) Sampling, with random start and orientation

  • "GRTS" : Generalized Random Tessellation Stratified sampling (Stevens and Olsen, 2004)

  • "SRS" : Simple Random Sampling

...

Optional arguments passed to underlying sample type method. See DETAILS.

Details

This is a S4 generic method for types SpatialPoints*, SpatialLines*, and SpatialPolygons* objects.

HAL, BAS, GRTS, SRS are fixed-size designs (return exactly n points). The SSS algorithm applied to Line and Point is fixed-sized. The SSS method applied to Polygon frames is variable-sized.

Options which determine characteristics of each sample time are passed via .... For example, spacing and "shape" of the grid in sss.* are controlled via spacing= and triangular=, while the J and eta parameters (which determine box sizes) are passed to hal.*. See documentation for hal.*, bas.*, sss.*, grts.*, and sss.* for the full list of parameters which determine sample characteristics.

Value

A SpatialPointsDataFrame object. At a minimum, the data frame embedded in the SpatialPoints object contains a column named siteID which numbers the points, and geometryID which contains the ID of the spatial object from which the point was drawn. If x is a Spatial*DataFrame, the return's data frame contains all attributes of x evaluated at the locations of the sample points.

Certain sampling routine add attributes that are pertinent to the design. For example, the grts.* routines add a pointType attribute. See documentation for the underlying sampling routine to interpret extra output point attributes.

Author(s)

Trent McDonald

References

Robertson, B.L., J. A. Brown, T. L. McDonald, and P. Jaksons (2013) "BAS: Balanced Acceptance Sampling of Natural Resources", Biometrics, v69, p. 776-784.

Stevens D. L. Jr. and A. R. Olsen (2004) "Spatially Balanced Sampling of Natural Resources", Journal of the American Statistical Association, v99, p. 262-278.

See Also

bas.polygon, bas.line, bas.point, hal.polygon, hal.line, hal.point, sss.polygon, sss.line, sss.point, grts.polygon, grts.line, grts.point

Examples

1
2
3
4
 WA.sample <- sdraw(WA, 100, "BAS")
 WA.sample <- sdraw(WA, 100, "HAL", J=c(6,4))
 WA.sample <- sdraw(WA, 100, "SSS", spacing=c(1,2))
 

Example output

Loading required package: sp
SDraw - Sample Draws (vers 2.1.3)
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files

SDraw documentation built on May 29, 2017, 6:14 p.m.