Skip to content

Instantly share code, notes, and snippets.

@sulrich
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save sulrich/21f1453ba437718807e3 to your computer and use it in GitHub Desktop.

Select an option

Save sulrich/21f1453ba437718807e3 to your computer and use it in GitHub Desktop.
# the behavior of the createDataPartition() operation is a little
# counter-intuitive - you're actually manipulating the the following command
# will select the index according to seaflow$pop, and store them in the vector
# trIndex
trIndex <- createDataPartition(foo$pop, p = 0.5, list = FALSE)
# then use the vector trIndex to split the data into training data frame and
# testing data frame.
trainDF <- foo[ trIndex,]
testDF <- foo[-trIndex,]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment