build_predictor_dataframe_from_data: Constructs a dataframe collecting the predictors from a...

Description Usage Arguments Value Examples

Description

'build_predictor_dataframe_from_data' extracts a dataframe containing the predictors in a formula, from a larger dataframe.

Usage

1

Arguments

form

A formula.

data

A dataframe.

Value

A dataframe.

Each column of the dataframe is the vector of values associated with a predictor in 'form', as extracted from 'data'.

If the formula has a dot as a predictor (e.g. Y ~ .), then the entire dataframe 'data' is returned minus the column containing the outcome. See the examples.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
library(RGOB)
dat <- data.frame(A = c(1,2,3,4)
                  X = c(5,6,7,8)
                  Z = c(1,0,1,0))
build_predictor_dataframe_from_data(A ~ X + Z, dat)
# returns: 
# X Z
# 5 1
# 6 0
# 7 1
# 8 0

build_predictor_dataframe_from_data(A ~ ., dat) # equivalent to previous call.

## End(Not run)

gwb/RGOB documentation built on May 14, 2021, 7:39 a.m.