Learn R Programming

modeltools (version 0.2-6)

ModelEnv-class: Class "ModelEnv"

Description

A class for model environments.

Arguments

Objects from the Class

Objects can be created by calls of the form new("ModelEnv", ...).

Details

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.

Examples

Run this code
### a new object
me <- new("ModelEnv")

### define a bivariate response variable
me@set("response", data.frame(y = rnorm(10), x = runif(10)))
me

### check if a response is available
has(me, "response")

### the dimensions
dimension(me, "response")

### extract the data
me@get("response")

### NA handling
df <- data.frame(x = rnorm(10), y = rnorm(10))
df$x[1] <- NA
mf <- ModelEnvFormula(x ~ y, data = df, na.action = na.pass)
mf
na.omit(mf)

Run the code above in your browser using DataLab