Description Usage Arguments Value Examples
View source: R/prepare_forestdata.R
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
| 1 2 3 4 5 6 7 8 9 10 | 
| 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 | 
NULL, because this function just sets global options to fluidify ForestData's usage.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # 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")
# checking that the options have been set
getOption("plot_col"); getOption("time_col")
# 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")
# If one column name is erroneous, then the function stops with explicit error message
## Not run: 
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..."
  
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.