putSSNdata.frame: putSSNdata.frame

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/putSSNdata.frame.r

Description

Replacet the data.frame in an Object of Class SpatialStreamNetwork

Usage

1
putSSNdata.frame(DataFrame, x, Name = "Obs")

Arguments

DataFrame

data.frame to be placed into the SpatialStreamNetwork-class object

x

an object of class SpatialStreamNetwork, influenceSSN, glmssn, or glmssn.predict

Name

the internal name of the data set in the object x. For observed values, this will always be "Obs", the default.

Details

The internal Name for observed data in objects of class SpatialStreamNetwork is "Obs" and it is the default. If another Name is specified, it must represent a prediction data set in the SpatialStreamNetwork-class, influenceSSN-class, glmssn-class, or "glmssn.predict" object. For SpatialStreamNetwork objects, these names are obtained using the call ssn@predpoints@ID. For all other object classes, the names are obtained using the call object$ssn.object@predpoints@ID. See examples for additional details.

Note that, the DataFrame must be of the same dimensions as the original data.frame in the object x.

Value

Returns an object of the same class as x.

Author(s)

Jay Ver Hoef support@SpatialStreamNetworks.com

See Also

getSSNdata.frame, SpatialStreamNetwork-class, influenceSSN-class, glmssn-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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
#mf04 <- importSSN(paste0(tempdir(),'/MiddleFork04.ssn', o.write = TRUE))
#use mf04 SpatialStreamNetwork object, already created
data(mf04)
#for examples only, make sure mf04p has the correct path
#if you use importSSN(), path will be correct
mf04 <- updatePath(mf04, paste0(tempdir(),'/MiddleFork04.ssn'))

# Take out the data.frame, make a change and put it back
obs.df <- getSSNdata.frame(mf04)
obs.df$Year_cat <- as.factor(obs.df$SampleYear)
mf04 <- putSSNdata.frame(obs.df, mf04)

SSN documentation built on March 13, 2020, 1:49 a.m.