| subsetData | R Documentation |
Collection of functions for subsetting a "data.frame" by rows or columns, and
to create training and test partitions.
splitFolds(data, k)
TrainingandTestData(data, percentage_test, discreteVariables = NULL)
splitdata(data, nameVariable, min, max)
data |
A dataset of class |
k |
The number of folds for k-fold cross validation, used in splitFolds function. |
percentage_test |
The proportion of data that goes to the test set (between 0 and 1), used in TrainingandTestData function. |
discreteVariables |
A |
nameVariable |
A |
min, max |
Boundary values to filter out, used in splitdata function. |
TrainingandTestData() returns a list of 2 elements containing the train and test datasets.
splitdata() returns a subset of observations.
## Dataset
X <- rnorm(1000)
Y <- rchisq(1000, df = 8)
Z <- rep(letters[1:10], times = 1000/10)
data <- data.frame(X = X, Y = Y, Z = Z)
## Training and Test Datasets
TT <- TrainingandTestData(data, percentage_test = 0.2)
TT$Training
TT$Test
## Subset Dataset
splitdata(data, nameVariable = "X", min = 2, max= 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.