Check the terms used in a dataset. A data.frame is returned that lists: unknown variables; required variables that are missing; character values that are not accepted; numeric variables that are out of the expected range; and variables with the wrong data type.

check_terms(records=NULL, metadata=NULL, longrecs=NULL, wth=NULL, soil=NULL, group="", check="all")

Arguments

records

data.frame with observations in "wide" format

metadata

data.frame with metadata

longrecs

data.frame with "long" format observations, for when there are multiple observations in time or depth for a single observational unit

wth

data.frame with weather data

soil

data.frame with soil data

group

character. Optional group name

check

character. "none" to do no checking; "nogeo" to not check coordinates. "all" and all other values to do all checks

Value

data.frame

Examples


records <- utils::read.csv(system.file("ex/records.csv", package = "carobiner"))
meta <- utils::read.csv(system.file("ex/metadata.csv", package = "carobiner"))

x <- check_terms(records, meta)
#> Warning: incomplete final line found on 'https://api.github.com/repos/controvoc/terminag/commits/main'
#> Cached as: /home/runner/.local/share/.carob/gadm/gadm36_adm0_r1_pk.rds
x
#>               check
#> 1 unknown variables
#> 2      bad datatype
#> 3 missing variables
#> 4      bad datatype
#> 5     out of bounds
#> 6       NA detected
#>                                                                   msg
#> 1                                                    crops, countries
#> 2                                    version (integer, not character)
#> 3                                                        harvest_date
#> 4 trial_id (integer, not character), plot_id (integer, not character)
#> 5                                 grain_P (15, 49), residue_P (1, 26)
#> 6                                                               yield