Functions to download and flatten commonly used tables and from Soil Data Access, and create soil profile collection objects (SPC).

  duplicates = FALSE,
  childs = TRUE,
  nullFragsAreZero = TRUE,
  rmHzErrors = FALSE,
  droplevels = TRUE,
  stringsAsFactors = default.stringsAsFactors()



text string formatted as an SQL WHERE clause (default: FALSE)


logical; if TRUE a record is returned for each unique mukey (may be many per nationalmusym)


logical; if FALSE parent material and geomorphic child tables are not flattened and appended


should fragment volumes of NULL be interpreted as 0? (default: TRUE), see details


should pedons with horizonation errors be removed from the results? (default: FALSE)


logical: indicating whether to drop unused levels in classifying factors. This is useful when a class has large number of unused classes, which can waste space in tables and figures.


logical: should character vectors be converted to factors? This argument is passed to the uncode() function. It does not convert those vectors that have set outside of uncode() (i.e. hard coded). The 'factory-fresh' default is TRUE, but this can be changed by setting options(stringsAsFactors = FALSE)


A data.frame or SoilProfileCollection object.


These functions return data from Soil Data Access with the use of a simple text string that formatted as an SQL WHERE clause (e.g. WHERE = "areasymbol = 'IN001'". All functions are SQL queries that wrap around SDAquery() and format the data for analysis.

Beware SDA includes the data for both SSURGO and STATSGO2. The areasymbol for STATSGO2 is US. For just SSURGO, include WHERE = "areareasymbol != 'US'".

If the duplicates argument is set to TRUE, duplicate components are returned. This is not necessary with data returned from NASIS, which has one unique national map unit. SDA has duplicate map national map units, one for each legend it exists in.

The value of nullFragsAreZero will have a significant impact on the rock fragment fractions returned by fetchSDA. Set nullFragsAreZero = FALSE in those cases where there are many data-gaps and NULL rock fragment values should be interpreted as NULLs. Set nullFragsAreZero = TRUE in those cases where NULL rock fragment values should be interpreted as 0.

Additional examples can be found in the Soil Data Access (SDA) Tutorial

See also


Stephen Roecker