From ee9d6e1533070c63cd21d5a2f67799415d328845 Mon Sep 17 00:00:00 2001 From: Suraj Yerramilli Date: Fri, 6 Feb 2015 22:46:27 +0530 Subject: added an example to documentation --- R/partition.R | 7 +++++++ man/dataPartition.Rd | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/R/partition.R b/R/partition.R index ab9dba6..0c92e76 100644 --- a/R/partition.R +++ b/R/partition.R @@ -35,6 +35,13 @@ dataSlice <- function(object,indices){ #' @param object an object of class \code{idframe} #' @param p the percentage of the data that goes to training (Default : \code{0.6}) #' @return list containing estimation and validation idframe objects +#' +#' @examples +#' data(cstr) +#' splitList <- dataPartition(cstr,p=0.6) +#' train <- splitList$estimation # training set +#' test <- splitList$validation # testing set +#' #' @export dataPartition <- function(object,p=0.6){ # check if the class is correct diff --git a/man/dataPartition.Rd b/man/dataPartition.Rd index 501ace2..afcc473 100644 --- a/man/dataPartition.Rd +++ b/man/dataPartition.Rd @@ -18,4 +18,10 @@ list containing estimation and validation idframe objects The function splits the data into training and validation sets and returns them bundled as a list. The size of the sets are determined by the parameter \code{p}. } +\examples{ +data(cstr) +splitList <- dataPartition(cstr,p=0.6) +train <- splitList$estimation # training set +test <- splitList$validation # testing set +} -- cgit