Description Details Objects from the Class Slots Methods Examples
A class for model environments.
Objects of class ModelEnv
basically consist of an
environment
for data storage as well as get
and
set
methods.
na.fail
returns FALSE
when at least one missing value occurs
in object@env
. na.pass
returns object
unchanged and
na.omit
returns a copy of object
with all missing values
removed.
Objects can be created by calls of the form new("ModelEnv", ...)
.
env
:Object of class "environment"
.
get
:Object of class "function"
for extracting
objects from environment env
.
set
:Object of class "function"
for setting
object in environment env
.
hooks
:A list of hook collections.
signature(object = "ModelEnv")
: copy an object.
signature(object = "ModelEnv", which = "character")
:
get the dimension of an object.
signature(object = "ModelEnv")
: Return
TRUE
, if the model environment contains no data.
signature(object = "ModelEnv", which = "character")
:
check if an object which
is available in env
.
signature(.Object = "ModelEnv")
: setup new
objects.
signature(object = "ModelEnv")
: show object.
signature(x = "ModelEnv")
: extract subsets from an
object.
na.action
method for ModelEnv
objects.
na.action
method for ModelEnv
objects.
na.action
method for ModelEnv
objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ### a new object
me <- new("ModelEnv")
## the new model environment is empty
empty(me)
### define a bivariate response variable
me@set("response", data.frame(y = rnorm(10), x = runif(10)))
me
## now it is no longer empty
empty(me)
### check if a response is available
has(me, "response")
### the dimensions
dimension(me, "response")
### extract the data
me@get("response")
df <- data.frame(x = rnorm(10), y = rnorm(10))
## hook for set method:
mf <- ModelEnvFormula(y ~ x-1, data = df, setHook=list(designMatrix=scale))
mf@get("designMatrix")
mf@set(data=df[1:5,])
mf@get("designMatrix")
### NA handling
df$x[1] <- NA
mf <- ModelEnvFormula(y ~ x, data = df, na.action = na.pass)
mf
na.omit(mf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.