| afspec {soil.spec} | R Documentation |
Sample data (113 samples) containing absorbances in the Mid infrared region (MIR) collected at 57 sites (Africa Sentinel Sites).
data(afspec)
The afspec data set contains two data frames — "samples" and "ab". "samples" table contains the following columns:
SAMPLEIDfactor; unique soil sample ID (duplicate IDs are possible as same soil sample can be measured twice)
Clusterinteger; Africa Sentinel Sites cluster number
Plotinteger; Africa Sentinel Sites plot number
Depthfactor; lower depth of the sampled horizon
Sitefactor; site name
Countryfactor; country name
Regionfactor; region name
Longitudenumeric; longitude in decimal degrees on the WGS84 datum (Lat in the LDSF Field Database)
Latitudenumeric; latitude in decimal degrees on the WGS84 datum (Lat in the LDSF Field Database)
"ab" table contains the following columns:
SAMPLEIDfactor; ...
m4003.5..m599.8numeric; mid-infrared raw absorbance for denoted wavenumbers (Bruker-LTS instrument)
other raw absorbance values
Africa Soil Information Service (http://africasoils.net)
Vagen, T., Shepherd, K. D., Walsh, M. G., Winowiecki, L., Desta, L. T., & Tondoh, J. E. (2010) AfSIS technical specifications: soil health surveillance. World Agroforestry Centre, Nairobi, Kenya.
World Agroforestry Centre (http://worldagroforestry.org)
library(sp)
library(rgdal)
data(afspec)
sp <- afspec$samples[,c("Longitude","Latitude")]
coordinates(sp) <- ~Longitude+Latitude
proj4string(sp) <- CRS("+proj=longlat +datum=WGS84")
## prepare 'samples' table
samples <- cbind(afspec$samples["SAMPLEID"],
MID="AfSIS-MIR",
DateTime=Sys.time())
## convert to "SpectraPoints"
afspec.sp <- SpectraPoints(Spectra=Spectra(samples, afspec$ab), sp=sp)
summary(afspec.sp)
get("attributes", spec.opts)
## predict soil pH:
data(m.PHIHOX)
PHIHOX <- predict(afspec.sp, model=m.PHIHOX)
data(m.ORCCNS)
ORCCNS <- predict(afspec.sp, model=m.ORCCNS)
## Not run:
library(plotKML)
afspec.pnts <- SpatialPointsDataFrame(sp, cbind(PHIHOX, ORCCNS))
data(SAGA_pal)
plotKML(afspec.pnts["PHIHOX"], colour_scale=rev(SAGA_pal[[1]]))
plotKML(afspec.pnts["ORCCNS"], colour_scale=SAGA_pal[[1]])
## plot with global soil legends:
library(GSIF)
data(soil.legends)
brks = c(soil.legends[["PHIHOX"]]$MIN[1]/10, soil.legends[["PHIHOX"]]$MAX/10)
pH.range <- cbind(soil.legends[["PHIHOX"]]$MAX, soil.legends[["PHIHOX"]]$MIN)
levs = paste(signif(rowMeans(pH.range)/10, 2))
afspec.pnts$Col <- cut(afspec.pnts$PHIHOX, breaks=brks, labels=levs)
plotKML(afspec.pnts["Col"], colour_scale=soil.legends[["PHIHOX"]]$COLOR)
## End(Not run)