get.mod {FlexParamCurve} | R Documentation |
Copy objects between R environments
Description
Function to copy objects between R environments
Usage
get.mod(modelname = ls(FPCEnv, pattern=".lis" ),
from.envir = FPCEnv, to.envir = .GlobalEnv,
write.mod = FALSE, silent = FALSE)
Arguments
modelname |
a character or character vector of object names |
from.envir |
R environment currently containing the object(s) |
to.envir |
destination R environment to copy the object(s) to |
write.mod |
logical specifying if single models should be assigned or simply returned |
silent |
logical specifying whether additional confirmation should be printed to the screen |
Details
All arguments are optional. With defaults, this function copies any nlsList
models
from the FlexParamCurve working environment to the Global Environment. However, user could use
this function to move any objects between any environments.
Default behavior is to assign models to an environment if more than 1 modelname is provided but to
simply return the model from the function if only 1 modelname is given. Notes are printed to the
screen to detail any models moved or any errors encountered.
Value
If only 1 modelname is provided, the contents of the object is returned. If more
more than 1 modelname is provided or if write.mod is FALSE then the object(s) will be assigned
to the environment and no value is returned.
Note
The default function works by detecting the suffix .lis rather than object class, so will
only return models with this suffix, not necessarily all nlsList
models if they have
different suffixes.
Author(s)
Stephen Oswald <steve.oswald@psu.edu>
See Also
Examples
#transfer all nlsList models from the FlexParamCurve working environmment (FPCEnv)
#to the Global Environment. Note: unless pn.mod.compare or
#pn.modselect.step have been run, in which case this is default
#1. subset data object (only 3 individuals) to expediate model selection
subdata <- subset(posneg.data, as.numeric(row.names (posneg.data) ) < 40)
#2. run model selection in FPCEnv using pn.mod.compare. Only two models (#1 and #5)
#specified to be run here to reduce processing time. see pn.mod.compare
modseltable <- pn.mod.compare(subdata$age, subdata$mass,
subdata$id, existing = FALSE, pn.options = "myoptions", mod.subset = c(1,5)
, Envir = FlexParamCurve:::FPCEnv)
#3. retrieve models from FlexParamCurve working environmment
get.mod()
#transfer an options file called myoptions from FPCEnv to the Global Environment
#note data are forced to fit a monotonic curve in this example
modpar(logist.data$age, logist.data$mass, pn.options = "myoptions.1", force4par = TRUE,
Envir = FlexParamCurve:::FPCEnv)
get.mod(modelname = "myoptions.1", write.mod = TRUE)