Skip to content

Instantly share code, notes, and snippets.

@sizhky
Last active May 22, 2017 12:06
Show Gist options
  • Save sizhky/49628bad121c662194018e16c91a4a77 to your computer and use it in GitHub Desktop.
Save sizhky/49628bad121c662194018e16c91a4a77 to your computer and use it in GitHub Desktop.
test_train_split <- function(data, train_frac = 0.66){
library(caret)
inTrain <- createDataPartition(1:nrow(data), p = train_frac, list = FALSE)
training <- data[inTrain,]
testing <- data[-inTrain,]
return(list(train = training, test = testing))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment