split_data_prob {stressor} | R Documentation |
This function takes in a data.frame object and the training size and returns a logical vector indicating which entries to include.
split_data_prob(data, test_prop)
data |
A data.frame object used to determine the length of the vector. |
test_prop |
A numeric that is between zero and one that represents the proportion of observations to be included in the test data. |
A logical vector is returned that is the same length as the number of rows of the data.
lm_data <- data_gen_lm(10)
indices <- split_data_prob(lm_data, .8)
train <- lm_data[indices, ]
test <- lm_data[!indices, ]