diff options
-rw-r--r-- | R/partition.R | 7 | ||||
-rw-r--r-- | man/dataPartition.Rd | 6 |
2 files changed, 13 insertions, 0 deletions
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 +} |