erf_data_prep: Prepare a data.frame for ERF

View source: R/erf_data_prep.R

erf_data_prepR Documentation

Prepare a data.frame for ERF

Description

Prepares a data.frame object for use with the ERF (not needed if using erf())

A data.frame with a new first column of var as a binary factor (duplicated if duplicate=TRUE), the header and covariates columns, and a random variable column

Usage

erf_data_prep(
  df = NULL,
  var = NULL,
  covariates = NULL,
  header = NULL,
  weights = NULL,
  duplicate = TRUE,
  mode = "bin"
)

Arguments

df

A data.frame object

var

A character string indicating the column name of the data frame that contains the number of interactions for the ERF to model; column should be a numeric column

covariates

A character vector indicating the column name(s) of the data frame that contain the covariates

header

A character vector indicating the column name(s) of the data frame that contain the additional columns you wish appended to the output

weights

a vector equal in length to nrow(df) of weights, NULL by default

duplicate

A logical flag that indicates whether to duplicate observations with more than one interaction. Default is TRUE to duplicate all records that interacted with more than one individual (i.e. a fishing set that caught two of the same species)

Examples

data <- erf_data_prep(df = simData$samples, var = 'obs', covariates = grep('cov', colnames(simData$samples), value=TRUE), header = c('prob.raw','prob'))
head(data)


zsiders/EnsembleRandomForests documentation built on Oct. 8, 2024, 11:41 p.m.