R/training_validation_sets.R

Defines functions training_validation_sets

Documented in training_validation_sets

training_validation_sets <- function(data, name_traj_ID, prop_train){

  training <- sample(levels(data[,name_traj_ID]),round(length(levels(data[,name_traj_ID]))*prop_train),replace=FALSE)
  lines <- NULL
  for (i in 1:length(training)){
    lines <- c(lines,which(data[,name_traj_ID] == training[i]))
  }
  training_set <- data[lines,]
  validation_set <- data[-lines,]
  return(list(training_set = training_set,validation_set = validation_set))

}
PabloMBooster/vmsR documentation built on June 29, 2023, 11:16 a.m.