Skip to contents

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 or DBIConnection to local 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"

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

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.

Examples

get_NASIS_column_metadata("texcl")
#>       DomainID    DomainName DomainRanked DisplayLabel ChoiceSequence
#> 12458      189 texture_class            0            1              1
#> 12454      189 texture_class            0            1              2
#> 12438      189 texture_class            0            1              3
#> 12446      189 texture_class            0            1              4
#> 12440      189 texture_class            0            1              5
#> 12448      189 texture_class            0            1              6
#> 12450      189 texture_class            0            1              7
#> 12442      189 texture_class            0            1              8
#> 12444      189 texture_class            0            1              9
#> 12443      189 texture_class            0            1             10
#> 12445      189 texture_class            0            1             11
#> 12439      189 texture_class            0            1             12
#> 12456      189 texture_class            0            1             13
#> 12453      189 texture_class            0            1             14
#> 12452      189 texture_class            0            1             15
#> 12457      189 texture_class            0            1             16
#> 12455      189 texture_class            0            1             17
#> 12451      189 texture_class            0            1             18
#> 12447      189 texture_class            0            1             19
#> 12441      189 texture_class            0            1             20
#> 12449      189 texture_class            0            1             21
#>       ChoiceValue ChoiceName          ChoiceLabel ChoiceObsolete
#> 12458          21          c                 Clay              0
#> 12454          17         cl            Clay loam              0
#> 12438           1        cos          Coarse sand              0
#> 12446           9       cosl    Coarse sandy loam              0
#> 12440           3         fs            Fine sand              0
#> 12448          11        fsl      Fine sandy loam              0
#> 12450          13          l                 Loam              0
#> 12442           5       lcos    Loamy coarse sand              0
#> 12444           7        lfs      Loamy fine sand              0
#> 12443           6         ls           Loamy sand              0
#> 12445           8       lvfs Loamy very fine sand              0
#> 12439           2          s                 Sand              0
#> 12456          19         sc           Sandy clay              0
#> 12453          16        scl      Sandy clay loam              0
#> 12452          15         si                 Silt              0
#> 12457          20        sic           Silty clay              0
#> 12455          18       sicl      Silty clay loam              0
#> 12451          14        sil            Silt loam              0
#> 12447          10         sl           Sandy loam              0
#> 12441           4        vfs       Very fine sand              0
#> 12449          12       vfsl Very fine sandy loam              0
#>                                                                                                                    ChoiceDescription
#> 12458 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12454 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12438 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12446 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12440 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12448 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12450 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12442 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12444 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12443 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12445 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12439 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12456 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12453 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12452 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12457 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12455 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12451 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12447 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12441 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#> 12449 Reference:  Soil Survey Manual, Agricultural Handbook No. 18, Soil Survey Staff, USDA, Natural Resources Conservation Service.
#>       ColumnPhysicalName ColumnLogicalName
#> 12458              texcl     texture_class
#> 12454              texcl     texture_class
#> 12438              texcl     texture_class
#> 12446              texcl     texture_class
#> 12440              texcl     texture_class
#> 12448              texcl     texture_class
#> 12450              texcl     texture_class
#> 12442              texcl     texture_class
#> 12444              texcl     texture_class
#> 12443              texcl     texture_class
#> 12445              texcl     texture_class
#> 12439              texcl     texture_class
#> 12456              texcl     texture_class
#> 12453              texcl     texture_class
#> 12452              texcl     texture_class
#> 12457              texcl     texture_class
#> 12455              texcl     texture_class
#> 12451              texcl     texture_class
#> 12447              texcl     texture_class
#> 12441              texcl     texture_class
#> 12449              texcl     texture_class