srs.point: Draw a Simple Random Sample (SRS) from a point resource or...

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

View source: R/srs.point.r

Description

Draw a systematic sample from a SpatialPoints* object or a data.frame. SpatialPoints* objects can represent point resources in 2-dimensional space, such as towns, event locations, or grid cell centers.

Usage

1
srs.point(x, n)

Arguments

x

A SpatialLines, SpatialLinesDataFrame, or data.frame object.

n

Sample size. Number of points or rows to draw from x. If n exceeds the number of units (= number of rows in data.frame(x)), a census is taken (i.e., x is returned).

Details

When x is a data frame, the simple random sample is drawn from the rows. That is, each row is viewed as a sample unit.

This draws equi-probable sample. First order inclusion probabilities are n/N for all units.

Value

If input x inherits from a the SpatialPoints class, a SpatialPointsDataFrame object containing locations and attributes in the sample is returned. If input x is a data.frame, a data.frame is returned. Attributes of the returned sample points are:

Additional attributes of the output object are:

Author(s)

Trent McDonald

See Also

srs.polygon, srs.line, sdraw

Examples

1
2
3
4
5
6
7
8
# Draw systematic sample across range of population
WA.samp <- srs.point( WA.cities, 100 )   
plot( WA.cities )
points( WA.samp, col="red", pch=16 )

# Draw systematic sample from data frame
df <- data.frame( a=1:100, b=runif(100) )
samp <- srs.point( df, 5 )   

SDraw documentation built on July 8, 2020, 6:23 p.m.