penv {pim}R Documentation

Extract a pim environment from a model or formula

Description

This function allows you to extract the pim.environment object from either a pim object or a pim.formula object.

Usage

penv(x)

## S4 method for signature 'pim.formula'
penv(x)

## S4 method for signature 'pim'
penv(x)

Arguments

x

either a pim or a pim.formula object

Value

In case of a pim object, the pim.environment contained therein. In case of a pim.formula object, the environment itself. See the help page pim.formula-class.

Examples

data("FEVData")
# Create the "model frame"
FEVenv <- new.pim.env(FEVData, compare="unique")

# create the formula and bind it to the pim.environment.
FEVform <- new.pim.formula(
  Age ~ I(L(Height) - R(Height))  ,
  FEVenv
)
theEnv <- penv(FEVform)
ls(theEnv)

themodel <- pim(Age ~ Height, FEVenv)
thePEnv <- penv(themodel)
thePEnv

ls(thePEnv)
# Note that this is a different environment, and that it only contains
# the variables in the formula, contrary to the environment created
# by new.pim.formula

[Package pim version 2.0.2 Index]