Description Usage Arguments Value Author(s) Examples
View source: R/createTestAndTrainSamples.R
This function creates train and test datasets given a database and the Y variable.
1 2 | createTestAndTrainSamples(dataset, yvar, seed = 12345,
percentage = 0.7)
|
dataset |
The dataset you want to split into test and train samples. |
yvar |
The Y variable in your dataset. |
seed |
The seed number used to generate the train and test samples. The default value is 12345. |
percentage |
The percentage of data that goes to training sample. The default value is 0.7. |
An object list with the train dataset, test dataset and the proportions.
Rodrigo Gonçalves and Leandro Daniel
1 2 3 4 5 6 7 8 9 10 11 | base = loansdefaulters
mydataset <- createTestAndTrainSamples(dataset = base,
yvar = "y_loan_defaulter",
seed = 12345,
percentage = 0.7)
# or
mydataset <- createTestAndTrainSamples(dataset = base, yvar = "y_loan_defaulter")
# to use the final samples and to see the proportion
mydataset$data.train
mydataset$data.test
mydataset$event.proportion
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.