This function retrieves the important fields of tables HeightClass and RegSpecies (of all periods) from the given database and checks for missing data or wrong input.

check_data_regspecies(database, forest_reserve = "all")

Arguments

database

name of Fieldmap/Access database (with specific Fieldmap structure) including path

forest_reserve

name of forest reserve for which the records in the database should be checked (defaults to "all")

Value

Dataframe with inconsistent data with ID's and additional columns aberrant_field (which column is wrong) and anomaly (what is wrong with the input)

Examples

library(forrescalc)
# (add path to your own fieldmap database here)
path_to_fieldmapdb <-
  system.file("example/database/mdb_bosres.sqlite", package = "forrescalc")
check_data_regspecies(path_to_fieldmapdb)
#> # A tibble: 6 × 8
#>   plot_id subplot_id heightclass_id period regspecies_id aberrant_field anomaly
#>     <int>      <int>          <int>  <int>         <int> <chr>          <chr>  
#> 1     204          1              2      3             1 number_class   missing
#> 2     204          1              2      3             2 number_class   missing
#> 3     204          1              2      3             3 number_class   missing
#> 4     204          1              2      3             4 number_class   missing
#> 5     204          1              2      3             5 number_class   missing
#> 6     204          1              2      3             6 number_class   missing
#> # ℹ 1 more variable: aberrant_value <dbl>
check_data_regspecies(path_to_fieldmapdb, forest_reserve = "Everzwijnbad")
#> # A tibble: 0 × 8
#> # ℹ 8 variables: plot_id <int>, subplot_id <int>, heightclass_id <int>,
#> #   period <int>, regspecies_id <int>, aberrant_field <chr>, anomaly <lgl>,
#> #   aberrant_value <dbl>