subsetSSN: Subset a SpatialStreamNetwork Object

View source: R/subsetSSN.r

subsetSSNR Documentation

Subset a SpatialStreamNetwork Object

Description

The subsetSSN function returns an SpatialStreamnetwork object that has been subset based on a logical expression.

Usage

subsetSSN(ssn, filename = "", subset, clip = FALSE)

Arguments

ssn

a SpatialStreamNetwork-class object

filename

the file path to the new .ssn folder, in string format. When writing, include the .ssn folder in the path

subset

logical expression indicating which elements or rows to keep: missing values are taken as false

clip

default = FALSE. If TRUE, create a subset of the edges and prediction sites, based on the same logical expression used to subset the observed sites, and export the subset data to the new .ssn folder

Value

subsetSSN returns an object of class SpatialStreamNetwork. It also creates and stores an SQLite database, binaryID.db, within the new .ssn directory.

Author(s)

Erin E. Peterson support@SpatialStreamNetworks.com

See Also

SpatialStreamNetwork-class

Examples

library(SSN)
#for examples, copy MiddleFork04.ssn directory to R's temporary directory
copyLSN2temp()
# Create a SpatialStreamNetork object
ssn <- importSSN(paste0(tempdir(),'/MiddleFork04.ssn'), o.write = TRUE)

ssn.sub1 <- subsetSSN(ssn, filename = 
  paste(tempdir(),"/subset1.ssn", sep = ""), subset = Summer_mn > 13)

# another example
#ssn.sub2 <- subsetSSN(ssn, filename = 
#  paste(tempdir(),"/subset2.ssn", sep = ""), subset = netID == 1, clip = TRUE)



jayverhoef/SSN documentation built on May 1, 2023, 1:04 p.m.