partition_random {cleandata} | R Documentation |
Designed to create a validation column. Optionally records the result into a log file.
partition_random(x, name = 'Partition', train, val = 10^ceiling(log10(train))-train, test = TRUE, seed = FALSE, log = eval.parent(in_log_default))
x |
The data frame |
name |
The name of the validation column. |
train |
The proportion of the training set. |
val |
The proportion of the validation set. If not given, a default value is calculated by assuming the sum of |
test |
Whether to have test set. If |
seed |
Whether to set a random seed. If you want a reproducible result, pass a number to |
log |
Controls log files. To produce log files, assign it or the |
A partitioned column.
x
can only be a data frame. Don't pass a vector to it.
# refer to vignettes if you want to use log files message('refer to vignettes if you want to use log files') # building a data frame A <- 2:16 B <- letters[12:26] df <- data.frame(A, B) # partitioning df0 <- partition_random(df, train = 7) df0 <- cbind(df, df0) print(df0) df0 <- partition_random(df, train = 7, val = 2) df0 <- cbind(df, df0) print(df0)