normTable {arealDB}R Documentation

Normalise data tables

Description

Harmonise and integrate data tables into standardised format

Usage

normTable(
  input = NULL,
  pattern = NULL,
  ontoMatch = NULL,
  outType = "rds",
  beep = NULL,
  update = FALSE,
  verbose = FALSE
)

Arguments

input

[character(1)]
path of the file to normalise. If this is left empty, all files at stage two as subset by pattern are chosen.

pattern

[character(1)]
an optional regular expression. Only dataset names which match the regular expression will be processed.

ontoMatch

[character(.)]
name of the column(s) that shall be matched with an ontology (defined in start_arealDB).

outType

[logical(1)]
the output file-type, currently implemented options are either *.csv (more exchangeable for a workflow based on several programs) or *.rds (smaller and less error-prone data-format but can only be read by R efficiently).

beep

[integerish(1)]
Number specifying what sound to be played to signal the user that a point of interaction is reached by the program, see beep.

update

[logical(1)]
whether or not the physical files should be updated (TRUE) or the function should merely return the new object (FALSE, default). This is helpful to check whether the metadata specification and the provided file(s) (translation and ID tables) are properly specified.

verbose

[logical(1)]
be verbose about translating terms (default FALSE). Furthermore, you can use suppressMessages to make this function completely silent.

Details

To normalise data tables, this function proceeds as follows:

  1. Read in input and extract initial metadata from the file name.

  2. Employ the function tabshiftr::reorganise to reshape input according to the respective schema description.

  3. The territorial names are matched with the gazetteer to harmonise new territorial names (at this step, the function might ask the user to edit the file 'matching.csv' to align new names with already harmonised names).

  4. Harmonise territorial unit names.

  5. If update = TRUE, store the processed data table at stage three.

Value

This function harmonises and integrates so far unprocessed data tables at stage two into stage three of the areal database. It produces for each main polygon (e.g. nation) in the registered data tables a file that includes all thematic areal data.

See Also

Other normalise functions: normGeometry()

Examples

if(dev.interactive()){
  # build the example database
  makeExampleDB(until = "normGeometry", path = tempdir())

  # normalise all available data tables ...
  normTable(update = TRUE)

  # ... and check the result
  output <- readRDS(paste0(tempdir(), "/adb_tables/stage3/Estonia.rds"))
}

[Package arealDB version 0.6.3 Index]