R/Split.R

Defines functions Split

Documented in Split

#' Split 
#' 
#' This function takes a dataset and the number of observations you would like split to test.
#' 
#' @param data The dataset you would like to split.
#' @param nobs The number of observations you want the test set to contain.
#' 
#' @export
#' 
#' 
Split <- function(data,nobs){
  
  out <- list()
  
  end <- length(data$X)
  sel <- end+1-nobs
  
  train <- data[1:(sel-1),]
  test <- data[sel:end,]
  
  out[[1]] <- train 
  out[[2]] <- test
  return(out)
}
dennist2/MerlinV1 documentation built on Dec. 11, 2019, 8:41 p.m.