variable_setup: Set up iFixit Answers data for model fitting or predictions

Description Usage Arguments Details Value Note Examples

Description

Used in fit_model function and to set up the data to be predicted on. This function subsets the data to all questions in English and creates all necessary variables.

Usage

1
variable_setup(data, forpredicting = FALSE)

Arguments

data

Answers data frame.

forpredicting

Set to true if this function will be used to set up the variables in the prediction data set, and will not try to set up the time_until_answer variable. Default is set to false. Default of this function is used in the fit_model function for setting up the data set to build the model on. The time_until_answer variable will be set up in this case.

Details

Variables created:

Value

Returns a data frame to be used in model fitting or predicting.

Note

If warnings about empty documents are output, they're from the function get_au_terms. This function uses the function get_freq_terms, which turns the input into a document term matrix with weighting = weightTfIdf

Examples

1
2
3
4
5
6
7
8
# setting up the data to build the model on
dir <- file.path(getwd(),"data")
out <- read.csv(file.path(dir, "answers_data.csv")) # data set without any variables set up

model <- fit_model(out) # fit_model calls variable_setup() within

# setting up variables in the prediction data
newdata <- oshitar::variable_setup(newdata, forpredicting = TRUE)

loshita/oshitar documentation built on May 8, 2019, 11:12 p.m.