subsetData | R Documentation |
Collection of functions for subsetting a "data.frame"
by rows or columns, and
to create training and test partitions.
TrainingandTestData(data, percentage_test, discreteVariables = NULL) newData(data, nameX, nameY) splitdata(data, nameVariable, min, max)
data |
A dataset of class |
percentage_test |
The proportion of data that goes to the test set (between 0 and 1). |
discreteVariables |
A |
nameX |
A |
nameY |
A |
nameVariable |
A |
min, max |
Boundary values to filter out. |
TrainingandTestData()
returns a list of 2 elements containing the train and test datasets.
newData()
and splitdata()
return a subset of variables or observations, respectively.
## 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) data <- discreteVariables_as.character(dataset = data, discreteVariables ="Z") ## Training and Test Datasets TT <- TrainingandTestData(data, percentage_test = 0.2) TT$Training TT$Test ## Subset Dataset newData(data, nameX = "X", nameY = "Z") 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.