prep_points: Prepare dsmartr points

View source: R/dsmartr_prepare.R

prep_pointsR Documentation

Prepare dsmartr points

Description

Prepares dsmartr point inputs for use in dsmartr::iterate().

Usage

prep_points(
  known_points = NULL,
  soil_id = NULL,
  x_coords = NULL,
  y_coords = NULL,
  covariates = NULL
)

Arguments

known_points

sfc_POINT, SpatialPointsDataFrame or Data Frame object; represents locations where the soil class has been directly observed. Supply with spatial location (spatial data or x and y attributes), unique numeric ID, and soil class.

soil_id

String; name of column in known_points holding soil class data.

x_coords

String; name of column in known_points holding x-coordinate data. Only needed for non-spatial inputs.

y_coords

String; name of column holding y-coordinate data. Only needed for non-spatial inputs.

covariates

RasterStack or RasterBrick; environmental covariate data.

Value

A data frame with two attributes: soil class code and corresponding raster cell index number.

Note

The output of this function is an optional input for iterate. If known_points is supplied as a data frame, the x and y coordinates must match the covariate crs.

Examples

## Not run: 
load('heronvale_known_sites')
load('heronvale_soilmap')
load('heronvale_covariates')

# data frame input:
pr_pts <- prep_points(known_points = heronvale_known_sites, soil_id = 'CLASS',
x_coords = 'x', y_coords = 'y', covariates = heronvale_covariates)

## End(Not run)

obrl-soil/dsmartr documentation built on Feb. 1, 2024, 10:57 p.m.