require(randomForest)
## Loading required package: randomForest
## randomForest 4.6-7
## Type rfNews() to see new features/changes/bug fixes.
splitForTrainingAndTest <- function(x, y, ratio=0.15) {
x <- as.matrix(x)
nInputs <- nrow(x)
y <- as.matrix(y)
ind=sample(nInputs);
trainIndices <- ind[nInputs * (1-ratio)]
testIndices <- ind[-trainIndices]
inputsTrain <- x[trainIndices,]
targetsTrain <- y[trainIndices,]
inputsTest <- x[testIndices,]
targetsTest <- y[testIndices,]
list(inputsTrain=inputsTrain, targetsTrain=targetsTrain, inputsTest=inputsTest, targetsTest=targetsTest)
}