This function counterbalances the high number of arguments in ForestData: many of these simply correspond to the input dataset column names, and have to be specified over and over when running each function. prepare_forestdata allows the user to specify these column names only once and then run all the functions without having to do it again

prepare_forestdata(
  data,
  plot_col = getOption("plot_col"),
  id_col = getOption("id_col"),
  time_col = getOption("time_col"),
  status_col = getOption("status_col"),
  size_col = getOption("size_col"),
  measure_type = getOption("measure_type"),
  POM_col = getOption("POM_col")
)

Arguments

data

data.frame, the forest census dataset that you want to treat with the ForestData r-package

plot_col

character, the name of the column containing plot indices

id_col

character, the name of the column containing tree unique ids

time_col

character, the name of the column containing census years or times

status_col

character, the name of the column containing tree vital statuses

size_col

character, the name of the column containing tree size measurements

measure_type

character indicating whether measures are circumferences ("C") or diameter ("D")

POM_col

character, the name of the column containing Point of Measurement (POM) values

Value

NULL, because this function just sets global options to fluidify ForestData's usage.

Examples

# Loading example dataset data(example_census) # specifying the example dataset's column names prepare_forestdata(example_census, plot_col="Plot", id_col="idTree", time_col="CensusYear", status_col = "CodeAlive", size_col="Circ", measure_type = "C", POM_col = "POM")
#> [1] "plot_col let to its default or previous value" #> [1] "id_col let to its default or previous value" #> [1] "time_col let to its default or previous value" #> [1] "status_col let to its default or previous value" #> [1] "size_col let to its default or previous value" #> [1] "measure_type let to its default or previous value" #> [1] "POM_col let to its default or previous value"
# checking that the options have been set getOption("plot_col"); getOption("time_col")
#> [1] "Plot"
#> [1] "CensusYear"
# If the function is run twice with similar specification for one #or several options, a message indicates that these specific option.s #kept unchanged prepare_forestdata(example_census, plot_col="Plot", id_col="idTree", time_col="CensusYear", status_col = "CodeAlive", size_col="Circ", measure_type = "C", POM_col = "POM")
#> [1] "plot_col let to its default or previous value" #> [1] "id_col let to its default or previous value" #> [1] "time_col let to its default or previous value" #> [1] "status_col let to its default or previous value" #> [1] "size_col let to its default or previous value" #> [1] "measure_type let to its default or previous value" #> [1] "POM_col let to its default or previous value"
# If one column name is erroneous, then the function stops with explicit error message if (FALSE) { prepare_forestdata(example_census, plot_col="SAUCISSON", id_col="idTree", time_col="CensusYear", status_col = "CodeAlive", size_col="Circ", measure_type = "C", POM_col = "POM") ## "Error in prepare_forestdata(example_census, ## plot_col = "SAUCISSON", id_col = "idTree", : ## plot_col is not any of your dataset's column name..." }