Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

SSN (version 1.1.17)

updatePath: Update Path Slot in SpatialStreamNetwork Object

Description

Updates the path slot in an existing SpatialStreamNetwork object based on a user-defined filepath.

Usage

updatePath(ssn, filepath)

Arguments

ssn

a SpatialStreamNetwork object

filepath

path name to the .ssn folder, in string format including quotes. Also include the .ssn folder in the path name

Author

Erin E. Peterson support@SpatialStreamNetworks.com

Details

At times, it may be necessary to move a .ssn directory, which is linked to a SpatialStreamNetwork object in an R workspace. If the .ssn directory is moved, the path slot must be updated before using the glmssn function. The updatePath function serves this purpose.

Examples

Run this code
library(SSN)

#for examples, copy MiddleFork04.ssn directory to R's temporary directory
copyLSN2temp()
# NOT RUN
# Create a SpatialStreamNetork object that also contains prediction sites
#mf04p <- importSSN(paste0(tempdir(),'/MiddleFork04.ssn'), 
#  predpts = "pred1km", o.write = TRUE)
#use mf04p SpatialStreamNetwork object, already created
data(mf04p)
#for examples only, make sure mf04p has the correct path
#if you use importSSN(), path will be correct
mf04p <- updatePath(mf04p, paste0(tempdir(),'/MiddleFork04.ssn'))


## UPDATE PATH FOR glmssn object
## get some model fits stored as data objects
data(modelFits)
## NOT RUN
## Fit a model to binary data
## binSp <- glmssn(MaxOver20 ~ ELEV_DEM + SLOPE, mf04p,
##   CorModels = c("Mariah.tailup", "Spherical.taildown"),
##   family = "binomial", addfunccol = "afvArea")
##for examples only, make sure binSp has the correct path
##if you use importSSN(), path will be correct
binSp$ssn.object <- updatePath(binSp$ssn.object, 
	paste0(tempdir(),'/MiddleFork04.ssn'))
summary(binSp)

Run the code above in your browser using DataLab