Learn R Programming

pim (version 2.0.2)

formula: Extract the formula from a pim or pim.formula object

Description

This function allows you to extract a formula from a pim or a pim.formula object. In the latter case, you extract the original formula.

Usage

formula(x, ...)

# S4 method for pim formula(x, orig = FALSE, ...)

# S4 method for pim.formula formula(x, ...)

Arguments

x

a pim or pim.formula object

...

arguments passed to other methods

orig

a locigal value indicating whether the original formula (TRUE) or the pim.formula object (FALSE) should be returned. Defaults to FALSE

Value

a pim.formula if x is a pim object and orig = TRUE. Otherwise a formula object.

Details

This function is based on formula from the stats package. It creates a generic and can hence be used more or less in the same way. Yet, as the pim package is dependent on the correct binding between the formula objects and different environments, it is advised not to change the environments tied to the formulas and to use this function only to extract the desired information.

See Also

pim.formula-class and pim-class for more information on the classes.

Examples

Run this code
# NOT RUN {
data("DysData")
themodel <- pim(SPC_D2 ~ Chemo, data = DysData)

thepimform <- formula(themodel)
formula(thepimform)
formula(themodel, orig = TRUE)

# }

Run the code above in your browser using DataLab