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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
\name{ModelEnv-class}
\docType{class}
\alias{ModelEnv-class}
\alias{clone}
\alias{clone,ModelEnv-method}
\alias{dimension}
\alias{dimension,ModelEnv,character-method}
\alias{empty}
\alias{empty,ModelEnv-method}
\alias{has}
\alias{has,ModelEnv,character-method}
\alias{initialize,ModelEnv-method}
\alias{show,ModelEnv-method}
\alias{subset,ModelEnv-method}
\alias{subset}
\alias{na.pass,ModelEnv-method}
\alias{na.pass}
\alias{na.fail,ModelEnv-method}
\alias{na.fail}
\alias{na.omit,ModelEnv-method}
\alias{na.omit}
\title{Class "ModelEnv"}
\description{ A class for model environments.}
\section{Objects from the Class}{
Objects can be created by calls of the form \code{new("ModelEnv", ...)}.
}
\section{Slots}{
\describe{
\item{\code{env}:}{Object of class \code{"environment"}.}
\item{\code{get}:}{Object of class \code{"function"} for extracting
objects from environment \code{env}.}
\item{\code{set}:}{Object of class \code{"function"} for setting
object in environment \code{env}.}
\item{\code{hooks}:}{A list of hook collections.}
}
}
\section{Methods}{
\describe{
\item{clone}{\code{signature(object = "ModelEnv")}: copy an object. }
\item{dimension}{\code{signature(object = "ModelEnv", which = "character")}:
get the dimension of an object. }
\item{empty}{\code{signature(object = "ModelEnv")}: Return
\code{TRUE}, if the model environment contains no data.}
\item{has}{\code{signature(object = "ModelEnv", which = "character")}:
check if an object \code{which} is available in \code{env}. }
\item{initialize}{\code{signature(.Object = "ModelEnv")}: setup new
objects.}
\item{show}{\code{signature(object = "ModelEnv")}: show object. }
\item{subset}{\code{signature(x = "ModelEnv")}: extract subsets from an
object. }
\item{na.pass}{\code{\link{na.action}} method for \code{ModelEnv} objects.}
\item{na.fail}{\code{\link{na.action}} method for \code{ModelEnv} objects.}
\item{na.omit}{\code{\link{na.action}} method for \code{ModelEnv} objects.}
}
}
\details{
Objects of class \code{ModelEnv} basically consist of an
\code{\link{environment}} for data storage as well as \code{get} and
\code{set} methods.
\code{na.fail} returns \code{FALSE} when at least one missing value occurs
in \code{object@env}. \code{na.pass} returns \code{object} unchanged and
\code{na.omit} returns a copy of \code{object} with all missing values
removed.
}
\examples{
### 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)
}
\keyword{classes}
|