Tuesday, 15 April 2014

r - Dummy Variables for Data Frame Containing only Predictors -


I know how to create a matrix with dummy variable if the response variable is part of the initial matrix:

trainx = model.matrix (survived ~ -1, data = train)

However, how can I do this for metrics in which only predictions are included has been done? This is a test set, so there is no conjecture. I do not know how the syntax works for that situation. Error in model.frame.default (object, data, xlave = xlave)

  model.matrix (~ test) error: Invalid type (list) variable for 'test'   

to work in different combinations and anything Not tried Note that there are columns in the test which are the factors as well as numeric.

Thank you.

model.metrics (~., Data = test)

In other words, leave the LHS of the formula. Do not keep the dataset name in itself!

No comments:

Post a Comment