Learn R Programming

soilDB (version 2.7.1)

get_OSD: Get Official Series Description Data from JSON, HTML or TXT sources

Description

Get Official Series Description Data from JSON, HTML or TXT sources

Usage

get_OSD(
  series,
  base_url = NULL,
  result = c("json", "html", "txt"),
  verbose = FALSE
)

Arguments

series

A character vector of Official Series names e.g. "Chewacla"

base_url

Optional: alternate JSON/HTML/TXT repository path. Default: NULL uses "https://github.com/ncss-tech/SoilKnowledgeBase" for result="json"

result

Select "json", "html", or "txt" output

verbose

Print errors and warning messages related to HTTP requests? Default: FALSE

Value

For JSON result: A data.frame with 1 row per series, and 1 column per "section" in the OSD as defined in National Soil Survey Handbook. For TXT or HTML result a list of character vectors containing OSD text with 1 element per series and one value per line.

Details

The default base_url for result="json" is to JSON files stored in a GitHub repository that is regularly updated from the official source of Series Descriptions. Using format: https://raw.githubusercontent.com/ncss-tech/SoilKnowledgeBase/main/inst/extdata/OSD/{LETTER}/{SERIES}.json for JSON. And "https://soilseriesdesc.sc.egov.usda.gov/OSD_Docs/{LETTER}/{SERIES}.html is for result="html" (official source).

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
if(requireNamespace("curl") &
   curl::has_internet()) {

series <- c("Musick", "Hector", "Chewacla")
get_OSD(series)
}
# }

Run the code above in your browser using DataLab