Description Usage Arguments Examples
By using a Train Index, this function easily creates train
and test
datasets.
1 |
x |
The Train Index variable indicating which observations belong to the |
df |
The entire data. |
df_train |
The desired name for the |
df_test |
The desired name for the |
1 2 3 4 5 6 7 8 9 10 11 12 | set.seed(123)
TrainIndex <- createDataPartition(ds$t_Paid, p = 0.7, # create a balanced partitions with respect to the target
list = FALSE, # change p for training data size
times = 1)
ds$TrainIndex <- 0
ds$TrainIndex[TrainIndex] <- 1
dts(x = "TrainIndex", df = ds, df_train = ds1, df_test = ds2)
# 'ds' is the entire data
# 'ds1' is the chosen name for the train sample
# 'ds2' is the chosen name for the test sample
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.