f_model_data_grid: generates a data grid based on a formula

Description Usage Arguments Value Examples

Description

the range of one specified variable is expanded, while all other variables are set to the most common values. Similar to modelr::data_grid but it can deal with factors.

Usage

1
2
f_model_data_grid(col_var, data_ls, formula, n = 500,
  set_manual = list())

Arguments

col_var

character vector, denoting variable that should be expanded

data_ls

data_ls object generated by f_clean_data(), or a named list list( data = <dataframe>, numericals = < vector with column names of numerical columns>)

formula

formula

n

integer, length of grid, datapoints in between range of col_var

set_manual

named list, set some variables manually instead of defaulting to median or most common factor. !! Values need to be of the same variable type as in the original data.

Value

dataframe

Examples

1
2
3
4
data_ls = f_clean_data(mtcars)
formula = disp~cyl+mpg+hp
f_model_data_grid( 'mpg', data_ls, formula,  10 )
f_model_data_grid( 'mpg', data_ls, formula,  10 , set_manual = list( cyl = min(data_ls$data$cyl) ) )

erblast/oetteR documentation built on May 27, 2019, 12:11 p.m.