Learn R Programming

soilDB (version 2.3)

uncode: Convert coded values returned from NASIS and SDA queries to factors

Description

These functions convert the coded values returned from NASIS or SDA to factors (e.g. 1 = Alfisols) using the metadata tables from NASIS. For SDA the metadata is pulled from a static snapshot in the soilDB package (/data/metadata.rda).

Usage

uncode(df, invert = FALSE, db = "NASIS", stringsAsFactors = default.stringsAsFactors())
code(df, ...)

Arguments

df

data.frame

invert

converts the code labels back to their coded values (FALSE)

db

label specifying the soil database the data is coming from, which indicates whether or not to query metadata from local NASIS database ("NASIS") or use soilDB-local snapshot ("LIMS" or "SDA")

stringsAsFactors

logical: should character vectors be converted to factors? The 'factory-fresh' default is TRUE, but this can be changed by setting options(stringsAsFactors = FALSE)

arguments passed on to uncode

Value

A dataframe with the results.

Details

These functions convert the coded values returned from NASIS into their plaintext representation. The converted values from NASIS, or sourced from SDA, are upgraded to specifically-leveled factors using the metadata tables from NASIS. For SDA the metadata is pulled from a static snapshot in the soilDB package.

Examples

Run this code
# NOT RUN {
# query component by nationalmusym
comp = fetchSDA_component(WHERE = "nationalmusym = '2vzcp'")
s = site(comp$spc)
s = uncode(s, NASIS = FALSE)
levels(s$taxorder)
# }

Run the code above in your browser using DataLab