Check all the input layers as defined by layers.csv and update required fields
CheckLayers(layers.csv, layers.dir, flds_id, verbose = TRUE)
layers.csv | path to comma-seperated value file with row of metadata for each dataset used in OHI analysis. |
---|---|
layers.dir | full path to the directory containing the layers files (csv files that correspond to each entry in layers.csv). |
flds_id | character vector of unique identifiers, typically
spatial, eg c('region_id', 'country_id', 'saup_id'), described in your |
verbose | if TRUE (default), extra diagnostics are output |
warning messages
This function goes through all the entries in layers.csv and does several checks (e.g., that each datalayer in layers.csv is present in the layers folder, etc.). This function appends the following information:
fld_id_num - name of field used as spatial identifier, if numeric
fld_id_chr - name of field used as spatial identifier, if character
fld_category - name of field used as category
fld_year - name of field used as year
fld_val_num - name of field used as value, from fld_value, if numeric
fld_val_chr - name of field used as value, from fld_value, if character
flds - data fields used for the layer
This function also appends the following diagnostic fields to layers.csv:
file_exists - input filename exists
year_min - minimum year, if year present
year_max - maximum year, if year present
val_min - minimum value, if numeric
val_max - maximum value, if numeric
val_0to1 - TRUE if value ranges between 0 and 1
flds_unused - unused fields from input file when guessing prescribed field names (aboves)
flds_missing - fields expected, as given by Layers units, and not found
rows_duplicated - given the combination of all row-identifying fields (and excluding value fields), the number of rows which are duplicates
num_ids_unique - number of unique ids, as provided by just the unique instances of the fld_id
# NOT RUN { CheckLayers(layers.csv, layers.dir, c('rgn_id','cntry_key','saup_id')) # }