Fieldmap database for inconsistenciesR/check_data_fmdb.R
check_data_fmdb.RdThis function retrieves the important fields of tables Trees, Shoots,
Deadwood, Regeneration, Regspecies, Vegetation, Herblayer, Plots
and Plotdetails (of all periods) from the given database and
checks for missing data or wrong input.
check_data_fmdb(database, forest_reserve = "all")Dataframe with inconsistent data with layer, ID's and
additional columns
aberrant_field (which column is wrong) and anomaly (what is wrong with
the input)
library(forrescalc)
# (add path to your own fieldmap database here)
path_to_fieldmapdb <-
system.file("example/database/mdb_bosres.sqlite", package = "forrescalc")
check_data_fmdb(path_to_fieldmapdb)
#> # A tibble: 96 × 14
#> plot_id tree_measure_id period aberrant_field anomaly aberrant_value layer
#> <int> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 204 1 1 iufro_hght not in lo… 0 Trees
#> 2 204 1 1 iufro_vital not in lo… 0 Trees
#> 3 204 1 1 iufro_socia not in lo… 0 Trees
#> 4 204 1540 1 iufro_hght not in lo… 0 Trees
#> 5 204 1540 1 iufro_vital not in lo… 0 Trees
#> 6 204 1540 1 iufro_socia not in lo… 0 Trees
#> 7 204 2 1 iufro_hght not in lo… 0 Trees
#> 8 204 2 1 iufro_vital not in lo… 0 Trees
#> 9 204 2 1 iufro_socia not in lo… 0 Trees
#> 10 1005 23 1 iufro_hght not in lo… 0 Trees
#> # ℹ 86 more rows
#> # ℹ 7 more variables: shoot_id <int>, lying_deadw_id <int>, subplot_id <int>,
#> # heightclass_id <int>, regspecies_id <int>, herblayer_id <int>,
#> # tree_id <chr>
check_data_fmdb(path_to_fieldmapdb, forest_reserve = "Everzwijnbad")
#> Warning: There was 1 warning in `mutate()`.
#> ℹ In argument: `min_period = min(.data$period)`.
#> Caused by warning in `min()`:
#> ! no non-missing arguments to min; returning Inf
#> # A tibble: 2 × 14
#> plot_id tree_measure_id period aberrant_field anomaly aberrant_value layer
#> <int> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 101 NA 1 max_diameter_mm too low 10 Dead…
#> 2 101 NA 1 alive_dead tree alive 11 Dead…
#> # ℹ 7 more variables: shoot_id <int>, lying_deadw_id <int>, subplot_id <int>,
#> # heightclass_id <int>, regspecies_id <int>, herblayer_id <int>, old_id <chr>