ssn_import_predpts {SSN2}R Documentation

Import prediction points into an SSN, ssn_lm, or ssn_glm object

Description

A shapefile of prediction points found in the .ssn directory are imported into an existing object of class SSN, ssn_lm, or ssn_glm.

Usage

ssn_import_predpts(x, predpts, format_additive = FALSE, names_additive = NULL)

Arguments

x

An object of classSSN, ssn_lm, or ssn_glm.

predpts

Name of the prediction point shapefile to import in character format, without the .shp extension.

format_additive

Logical indicating whether the columns containing the addtive function values should be formated for SSN2. Default = FALSE.

names_additive

Character vector of column names in observed and prediction site datasets containing additive function values. Must be defined if format_additive = TRUE. Default = NULL.

Details

ssn_import_predpts imports a shapefile of prediction points residing in the .ssn directory into an existing SSN, ssn_lm, or ssn_glm object. The prediction dataset must reside in the ssn.object$path directory. The path for an SSN object can be updated using ssn_update_path() prior to importing prediction datasets. Note that, the prediction dataset must contain the spatial, topological and attribute information needed to make predictions using an ssn_lm or ssn_glm object. This information can be generated using a number of proprietary and open source software tools:

Value

an object of class SSN, ssn_lm, or ssn_glm which contains the new prediction dataset. The name of the prediction dataset in the preds list corresponds to the basenames of the prediction site shapefiles (without the .shp extension) specified in predpts. See ssn_import for a detailed description of the prediction dataset format within the SSN class object.

References

Kattwinkel, M., Szocs, E., Peterson, E., and Schafer, R.B. (2020) Preparing GIS data for analysis of stream monitoring data: The R package openSTARS. PLOS One 15(9), e0239237. Peterson, E., and Ver Hoef, J.M. (2014) STARS: An ArcGIS toolset used to calculate the spatial information needed to fit spatial statistical stream network models to stream network data. Journal of Statistical Software 56(2), 1–17.

Examples

## Create local temporary copy of MiddleFork04.ssn found in
# SSN2/lsndata folder. Only necessary for this example.
copy_lsn_to_temp()

## Import SSN object with no prediction sites
mf04p <- ssn_import(paste0(tempdir(), "/MiddleFork04.ssn"),
  overwrite = TRUE
)

## Import pred1km prediction dataset into SSN object
mf04p <- ssn_import(paste0(tempdir(), "/MiddleFork04.ssn"))
mf04p <- ssn_import_predpts(mf04p, predpts = "pred1km")
names(mf04p$preds)

## Import pred1km prediction dataset into a ssn_glm object
ssn_gmod <- ssn_glm(Summer_mn ~ netID, mf04p,
  family = "Gamma",
  tailup_type = "exponential", additive = "afvArea"
)
ssn_gmod <- ssn_import_predpts(ssn_gmod, predpts = "CapeHorn")
names(ssn_gmod$ssn.object$preds)

[Package SSN2 version 0.1.1 Index]