ncss-tech / soilDB

soilDB: Simplified Access to National Cooperative Soil Survey Databases
http://ncss-tech.github.io/soilDB/
79 stars 19 forks source link

fetchLDM: add `area_type` argument for non-SSA area queries #328

Closed brownag closed 7 months ago

brownag commented 7 months ago

With https://github.com/ncss-tech/soilDB/commit/47166aed0f80a99acdde0d472d6cf4c2a058bcba can use the area_type argument to choose lab data from SSA, country, state, county, MLRA, national forest/park.

For example: get chemical properties for all layers in MLRA 22A:

library(soilDB)

x <- fetchLDM("22A", 
              what = "area_code", 
              area_type = "MLRA", 
              tables = "lab_chemical_properties")
#> single result set, returning a data.frame
#> converting profile IDs from integer to character
#> Warning: Horizon bottom depths contain NA! Check depth logic with
#> aqp::checkHzDepthLogic()

x$new_zealand_phosphorus_retent |> 
  density(na.rm=T, from=0, to=100) |> 
  plot()

Closes #294