
Read a horizon spreadsheet (CSV/TSV) into a PedonRecord
Source:R/read-pedon-csv.R
read_pedon_csv.RdThe everyday entry point for anyone who has a soil profile in a spreadsheet:
one row per horizon, one column per attribute, using soilKey's canonical
column names (top_cm, bottom_cm, designation,
clay_pct, ph_h2o, munsell_hue_moist, ...). The full list
is names(horizon_column_spec()); the quickest start is the bundled
template
system.file("extdata", "perfil_exemplo.csv", package = "soilKey").
Arguments
- file
Path to a
.csv(comma) or.tsv(tab) file, one row per horizon.- site
Optional named list of site metadata (see
PedonRecord). Defaults tolist(id = <file base name>).- sep
Field separator.
"auto"(default) uses a tab for.tsvfiles and a comma otherwise.
Value
A PedonRecord.
Details
Only recognised columns are used (any extras are carried through untouched),
so a messy export still works - soilKey simply uses the columns it
understands. Site metadata (id, lat/lon, soil moisture / temperature regime)
is optional and passed via site; without it the profile still
classifies, just with less specificity where site data would have refined the
name.
See also
classify_csv to go straight from a file to the three
classifications; classify_all; PedonRecord.
Examples
f <- system.file("extdata", "perfil_exemplo.csv", package = "soilKey")
pedon <- read_pedon_csv(f)
classify_all(pedon)$summary
#> wrb
#> 1 Chromic Ferralsol (Clayic, Ochric, Rubic)
#> sibcs usda
#> 1 Latossolos Vermelhos Distróficos típicos, argilosa, moderado Typic Hapludox