get_NASIS_metadata: Get NASIS Metadata (Domain, Column and Choice Lists)

View source: R/uncode.R

get_NASIS_metadataR Documentation

Get NASIS Metadata (Domain, Column and Choice Lists)

Description

Retrieve a table containing domain and column names with choice list labels/names/sequences/values from the NASIS 7 metadata tables.

Usage

get_NASIS_metadata(dsn = NULL, include_description = FALSE)

get_NASIS_column_metadata(
  x,
  what = "ColumnPhysicalName",
  include_description = FALSE,
  dsn = NULL
)

Arguments

dsn

Optional: path to local SQLite database containing NASIS table structure; default: NULL

include_description

Include "ChoiceDescription" column? Default: FALSE

x

character vector to match in NASIS metadata

what

Column to match x against. Default "ColumnPhysicalName"; alternate options include "DomainID", "DomainName", "DomainRanked", "DisplayLabel", "ChoiceSequence", "ChoiceValue", "ChoiceName", "ChoiceLabel", "ChoiceObsolete", "ChoiceDescription", "ColumnLogicalName"

Details

These data are derived from the MetadataDomainDetail, MetadataDomainMaster, and MetadataTableColumn tables and help with mapping between values stored in the NASIS database and human-readable values. The human-readable values align with the values returned in public facing interfaces such as SSURGO via Soil Data Access and NASIS Web Reports. The data in these tables can also be used to create ordered factors where options for levels of a particular data element follow a logical ChoiceSequence.

If a local NASIS instance is set up, and this is the first time get_NASIS_metadata() has been called, the metadata will be obtained from the NASIS local database. Subsequent runs in the same session will use a copy of the data object NASIS.metadata cached in soilDB.env which can be accessed with get_soilDB_env()$NASIS.metadata.

For users without a local NASIS instance, a cached copy of the NASIS metadata are used (data/metadata.rda).

See ?soilDB::metadata for additional details.

Value

a data.frame containing DomainID, DomainName, DomainRanked, DisplayLabel, ChoiceSequence, ChoiceValue, ChoiceName, ChoiceLabel, ChoiceObsolete, ColumnPhysicalName, ColumnLogicalName and optionally ChoiceDescription when include_description=TRUE.

a data.frame containing selected NASIS metadata sorted first on DomainID and then on ChoiceSequence

Examples

get_NASIS_metadata()
get_NASIS_column_metadata("texcl")

soilDB documentation built on Nov. 17, 2023, 1:09 a.m.