class_df_from_term: The function '?class_df_from_term()'

Description Usage Arguments Value Examples

View source: R/class_df_from_term.R

Description

Looks up and returns the class of the data.frame column(s) associated with a model's term.

Usage

1
class_df_from_term(model, class_post_formula = FALSE)

Arguments

model

an 'lm' object

class_post_formula

if FALSE (default), returns class of df col BEFORE any in-formula transformations applied to terms if TRUE, returns class of df col AFTER any in-formula transformations applied to terms

Value

a named list containing named character vectors. The list names are model terms. The vector names are data frame column names. The vector values are characters for the data frame column's class. NOTE: If any in-formula transformations were applied, the data.frame referenced would represent an 'intermediate' one that is not exactly the originating data.frame passed to the 'data' arg of lm(data=.).

Examples

1
2
3
4
5
6
7
8
model = lm(data = iris,Sepal.Length ~ Species + as.numeric(Species) +
             Species:Sepal.Width + as.factor(Sepal.Width)+
             as.factor(Sepal.Width)*as.factor(Petal.Length)+
             as.numeric(Species)*as.factor(Petal.Length))

class_df_from_term(model,class_post_formula = TRUE)

class_df_from_term(model,class_post_formula = FALSE)

statsccpr/sensemakr documentation built on May 30, 2019, 10:41 a.m.