train_val: Split Habitat Data into training and Validation Data

View source: R/train_val.R

train_valR Documentation

Split Habitat Data into training and Validation Data

Description

Splits data into training and validation samples. Uses stratified random sampling without replacement. Will randomly draw the specified proportion without replacement from each class to generate validation data. Training set is the original data with the observations from validation data removed. Returns a list containing training data as the first element and validation data as the second element. The list elements will be the same data type as the input of my_data

Usage

train_val(my_data, hab_col, prop_val, seed = NULL)

Arguments

my_data

a spatialpoints dataframe containing, dataframe, or tibble containing all data

hab_col

number specifying the column to check

prop_val

proportion of samples to be used in validation

seed

sampling is initiated by set.seed(seed) if input is not NULL. This will generate consistent results


ailich/mytools documentation built on Jan. 7, 2023, 11:16 a.m.