# preprocessr
#
# Function: partition()
#
# Description: A function to partition data into a test and train set
#
# Author: Peter Xenopoulos
#
#
partition <- function( data , pct.train ) {
# Generate those rows which will be in the train data set
train <- sample( nrow(data) , pct.train*nrow(data) , replace = TRUE )
# Partition data into a list
data.list <- list(data[train,],data[-train,])
# Return data
return(data.list)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.