| partition | R Documentation |
Randomly partitions data into two or more subsets according to the supplied ratios. Optionally, stratified partitioning can be performed using a categorical or numerical variable.
partition(data, ratio = c(0.7, 0.3), strata = NULL, set.seed = NULL)
data |
An ( |
ratio |
A numeric vector specifying the proportions of observations assigned to the partitions. |
strata |
Optional variable used for stratified partitioning. For categorical variables, the proportions of the levels are approximately preserved across partitions. For numerical variables, observations are distributed across partitions according to their ordered values. |
set.seed |
A single value, interpreted as an integer, or |
A list containing the data partitions.
Reza Mohammadi a.mohammadi@uva.nl
data(iris)
parts <- partition(iris, ratio = c(0.7, 0.3), set.seed = 42)
sapply(parts, nrow)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.