computeCellSize: computeCellSize - Compute the 'cellsize' parameter for...

View source: R/generatePolygonSamplePoints.R

computeCellSizeR Documentation

computeCellSize – Compute the cellsize parameter for spsample for a sample area

Description

Compute the value for the cellsize parameter for the spsample function in the sp package to generate a sample grid representing area square units. This is a helper function for generatePolygonSamplePoints to help develop sample points that represent a given sample area.

Usage

computeCellSize(area = 6000, aunits = "acre", pattern = "hexagonal")

Arguments

area

numeric: Area represented by each sample point in acres or hectares.

aunits

character string: Units for area. Valid choices are "acres" and "hectares". Only the first letter is needed and case doesn't matter.

pattern

character string: the desired sampling pattern. Valid choices are "regular" and "hexagonal". Only the first letter is needed and cae doesn't matter.

Value

Numeric value used as input to the spsample function for the cellsize parameter. Units will match the units associated with aunits (feet for acres and meters for hectares).

Examples

# 6000 acre sample area with value returned in feet
computeCellSize(3000, "acre")
# 1000 hectare sample area with value returned in meters
computeCellSize(1000, "hectare")

bmcgaughey1/HexSampleR documentation built on July 1, 2024, 10:02 p.m.