getvariables {plgraphics}R Documentation

Extract Variables or Variable Names for Model Fitting

Description

Extracts the variables names (getvarnames occurring in a formula, in raw form (as get\_all\_vars) or in transformed form (as model.frame does it).

Usage

getvariables(formula, data = NULL, transformed = TRUE,
  envir = parent.frame(), ...)
getvarnames(formula, data = NULL, transformed = FALSE)

Arguments

formula

a model 'formula' or 'terms' object or an R object.

data

a data.frame, list or environment (or object coercible by 'as.data.frame' to a data.frame), containing the variables in 'formula'. Neither a matrix nor an array will be accepted.

transformed

logical. If TRUE, variables will be extracted as transformed in formula, otherwise, untransformed variables are returned.

envir

environment in which the formula will be evaluated

...

further arguments such as data, weight, subset, offset used to create further columns in the resulting data.frame, with parenthesised names such as '"(offset)"'

Value

For getvarnames: list of character vectors containing

varnames

names of all variables (transformed=FALSE) or simple terms (transformed=TRUE)

xvar

those from the right hand side of the formula

yvar

left hand side

For getvariables: data.frame containing the extracted variables or simple terms.

Author(s)

Werner A. Stahel

See Also

model.frame, get_all_vars

Examples

data(d.blast)
getvariables(log10(tremor)~log10(distance)*log10(charge), data=d.blast)

[Package plgraphics version 1.0 Index]