Learn R Programming

spsurvey (version 4.0.0)

sbcframe: Calculate Spatial Balance Grid Cell Extent and Proportions for a Sample Frame

Description

This function calculates spatial balance grid cell extent and proportions for the sample frame.

Usage

sbcframe(shapefilename = NULL, spframe = NULL, nrows = 5,
  dxdy = TRUE)

Arguments

shapefilename

Name of the input shapefile. If shapefilename equals NULL, then the shapefile or shapefiles in the working directory are used. The default is NULL.

spframe

An sp package object of class SpatialPointsDataFrame, SpatialLinesDataFrame, or SpatialPolygonsDataFrame that contains the survey design frame. The default is NULL.

nrows

Number of rows (and columns) for the grid of cells. The default is 5.

dxdy

Indicator for equal x-coordinate and y-coordinate grid cell increments, where TRUE means the increments are equal and FALSE means the increments are not equal. The default is TRUE.

Value

List containing the following components:

extent

the frame extent for each grid cell

prop

the frame proportion for each grid cell

xmin

the grid x-coordinate minimum value

xmax

the grid x-coordinate maximum value

ymin

the grid y-coordinate minimum value

ymax

the grid y-coordinate maximum value

dx

the grid cell x-coordinate increment value

dy

the grid cell y-coordinate increment value

xc

the vector of grid cell x-coordinates

yc

the vector of grid cell y-coordinates

Other Functions Required

readShapeFile

C function to read a single shapefile or multiple shapefiles

readShapeFilePts

C function to read the shp file of a point shapefile and return a data frame containing the x-coordinates and y-coordinates for elements in the frame

cell.wt

calculates number of points in a cell for a points object

insideLinearGridCell

C function to determine ID value and clipped polyline length for shapefile records contained in the selected grid cells

insideAreaGridCell

C function to determine ID value and clipped polygon area for shapefile records contained in the selected grid cells