putSSNdata.frame: putSSNdata.frame

View source: R/putSSNdata.frame.r

putSSNdata.frameR Documentation

putSSNdata.frame

Description

Replacet the data.frame in an Object of Class SpatialStreamNetwork

Usage

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


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 7, 2023, 5:30 p.m.