View source: R/putSSNdata.frame.r
putSSNdata.frame | R Documentation |
Replacet the data.frame in an Object of Class SpatialStreamNetwork
putSSNdata.frame(DataFrame, x, Name = "Obs")
DataFrame |
data.frame to be placed into the SpatialStreamNetwork-class object |
x |
an object of class |
Name |
the internal name of the data set in the object |
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
.
Returns an object of the same class as x
.
Jay Ver Hoef support@SpatialStreamNetworks.com
getSSNdata.frame
, SpatialStreamNetwork-class
, influenceSSN-class
,
glmssn-class
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.