This function reads a table in .csv format from git repository forresdat (and saves the forresdat data to a local temp directory to avoid unneeded downloading in the future). Data available in forresdat only contains observations, so no records with zero values are added for for instance species that were not observed and hence absent. These zero value records can easily be added by using the function add_zeros(). To load table plotinfo, set argument join_plotinfo = FALSE.

read_forresdat_table(
  tablename,
  join_plotinfo = TRUE,
  plottype = c("CP", "CA", "all")
)

Arguments

tablename

name of the table that should be read

join_plotinfo

should table plotinfo be joined to the chosen table to add columns forest_reserve, survey_dendro/deadw/reg/veg (TRUE or FALSE) and data_processed (TRUE or FALSE)? Default is TRUE. (This is only possible if the given table contains a column plot_id, so this parameter should be put FALSE if this column is absent.) Must be FALSE if you want to load the table plotinfo itself.

plottype

Data of which plottype (used method) should be retrieved? Default is 'CP' or 'circle plot', alternatively 'CA' or 'core area', or 'all' (retrieve both circle plots and core areas) could be chosen.

Value

A dataframe with the specified table, default columns plottype, forest_reserve, survey_dendro/deadw/reg/veg (TRUE or FALSE) and data_processed (TRUE or FALSE). To be able to recall the version of the data, this dataframe contains an attribute with the version number of the release of forresdat from which the data are taken.

Examples

library(forrescalc)
data_dendro <- read_forresdat_table(tablename = "dendro_by_plot")
#> Rows: 17 Columns: 16
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr  (1): plottype
#> dbl (15): plot_id, year, period, number_of_tree_species, number_of_trees_ha,...
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Rows: 17 Columns: 13
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (2): forest_reserve, plottype
#> dbl (4): plot_id, period, survey_number, year_dendro
#> lgl (7): survey_trees, survey_deadw, survey_veg, survey_reg, game_impact_veg...
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Warning: The dataset only contains presence data and lacks zero observations (except for 1 observation per plot_id and period to indicate that observations are done).  Please use function add_zeros() to add zero observations when needed.
data_dendro
#> # A tibble: 9 × 26
#>   plot_id  year period number_of_tree_species number_of_trees_ha stem_number_ha
#>     <dbl> <dbl>  <dbl>                  <dbl>              <dbl>          <dbl>
#> 1     204  2000      1                      1               23.9           23.9
#> 2    2006  2000      1                      1               10.6           10.6
#> 3     101  2002      1                      3              364.           521. 
#> 4    1005  2006      1                      1               42.4           42.4
#> 5    2006  2010      2                      1               10.6           10.6
#> 6     204  2011      2                      1               23.9           23.9
#> 7     101  2012      2                      2              206.           285. 
#> 8    1005  2016      2                      1               42.4           42.4
#> 9    2006  2020      3                      1               10.6           10.6
#> # ℹ 20 more variables: basal_area_alive_m2_ha <dbl>,
#> #   basal_area_dead_m2_ha <dbl>, vol_alive_m3_ha <dbl>,
#> #   vol_dead_standing_m3_ha <dbl>, vol_bole_alive_m3_ha <dbl>,
#> #   vol_bole_dead_m3_ha <dbl>, vol_log_m3_ha <dbl>, vol_deadw_m3_ha <dbl>,
#> #   stems_per_tree <dbl>, forest_reserve <chr>, plottype <chr>,
#> #   survey_number <dbl>, year_dendro <dbl>, survey_trees <lgl>,
#> #   survey_deadw <lgl>, survey_veg <lgl>, survey_reg <lgl>, …
attr(data_dendro, "forresdat")
#> [1] "forresdat release v0.0.3"