checkInputData: Check Data Set

View source: R/checkInputData.R

checkInputDataR Documentation

Check Data Set

Description

Checks the content and consistency of a candidate data set for calculating the Nature Index.

Usage

checkInputData(
  inputData = NULL,
  indicators = NULL,
  referenceValues = NULL,
  indicatorObservations = NULL,
  ICunits = NULL,
  BSunits = NULL,
  ecosystems = NULL,
  NIunits = NULL
)

Arguments

inputData

list with elements named

[1] "indicators",
[2] "referenceValues",
[3] "indicatorObservations",
[4] "ICunits",
[5] "BSunits",
[6] "ecosystems",
[7] "NIunits",

where the second and third elements are lists, while the others are data.frames. The last two element, "ecosystems" and "NIunits", may be omitted or set to NULL.

indicators

data.frame containing indicator characteristics.

referenceValues

list containing reference value characteristics.

indicatorObservations

list containing indicator observations characteristics.

ICunits

data.frame containing ICunits characteristics.

BSunits

data.frame containing BSunits characteristics.

ecosystems

data.frame containing ecosystems characteristics.

NIunits

data.frame containing NIunits characteristics.

Details

checkInputData runs through an extensive series of tests checking whether the entered dataset contains all the necessary data objects and variables for calculating the Nature Index, and whether the data contain consistent information.

The function checks

  • that all necessary types of data objects are included:

    • indicators,

    • reference values,

    • indicator observations,

    • ICunits,

    • BSunits,

    • ecosystems (not required),

    • NIunits (not required)

  • that all required variables characterizing each object type are included.

  • that IDs and/or names are unique for all types of objects.

  • consistency among input objects of different types.

  • for missing values.

While running through the tests, checkInputData generates error messages or warnings when identifying missing or inconsistent information. The function may make some simple modifications to the data set to mend shortcomings. It issues warning messages explaining such modifications.

The data set to be checked may be entered either as a list assigned to the argument inputData and containing all types of objects, or as several objects, one for each type, assigned to the other function arguments.

Value

either a list with the same elements that was assigned to function arguments,

or

a set of error messages.

Author(s)

Bård Pedersen

See Also

assembleNiObject and niInput for more about the requirements to input data, importDatasetApi, getNIdata, and niDataImport for importing data from the NI database.

Examples

## Not run: 
carnivoreImport <- importDatasetApi(
     username = "...",
     password = "...",
     eco = NULL,
     indic = c("Jerv","Gaupe","Ulv"),
     year = c("1990","2000","2010","2014","2019"))
checkInputData(inputData = carnivoreImport)

checkInputData(BSunits = 1)

## End(Not run)


NINAnor/NIcalc documentation built on Oct. 26, 2023, 9:37 a.m.