AQP News and Updates

Submitted by dylan on Tue, 2013-03-12 15:51.

The AQP family of R packages has seen a lot of development over the last 3 months. Some of the highlights include:

  1. HTML manual pages with syntax-highlighting and figures, c/o knitr
  2. new vignettes: "dealing with bad data", gridded SSURGO (gSSURGO) demo, and "aggregating properties by bedrock kind"
  3. a new package called sharpshootR containing misc. functions to support soil survey
  4. slab() has been re-written and is now much more efficient (with memory), transparent (10x fewer lines of code), and "slab functions" are much simpler to write.

 
aqp package NEWS file

-------------------------- aqp 1.5-1 (2013-03-07) --------------------------
* removed excessive checking in SoilProfileCollection init code, this may speed things up
  - previously identified horizonation errors may no longer result in ERRORS; be sure to test
* test_hz_logic() now more useful:
  - always checks for NA and overlapping horizons
  - no longer called with initialization of SoilProfileCollection objects
  - note that default behavior has changed since version 1.5
  - moved related documentation to test_hz_logic manual page
* new mini-vignette on dealing with bad data (dealing-with-bad-data.html)
* better documentation for slice()
* new warnings related to missing data in the grouping variable passed to slab()


-------------------------- aqp 1.5 (2013-02-24) --------------------------
* profileApply() can now return arbitrary objects = new subsetting/transformation possibilities
  - see ?profileApply for examples
* panel.depth_function() can now display contributing fraction values with grouped data
  - see multi-variate example in ?slab

-------------------------- aqp 1.4-7 (2013-01-24) --------------------------
* HTML version of all documentation (including images) auto-generated via knitr and available on the r-forge website
* new function: texture.triangle.low.rv.high() plots texture data with low-high range defined by quantiles

-------------------------- aqp 1.4-6 (2013-01-03) --------------------------
* updated documentation and SoilProfileCollection tutorial here:
  - https://r-forge.r-project.org/scm/viewvc.php/*checkout*/docs/aqp/aqp-intro.html?root=aqp
* plans laid for parallel processing in slab() and profileApply() via 'parallel' package
* plotSPC() gets a 'density' argument for shaded coloring of horizons

-------------------------- aqp 1.4-5 (2012-12-29) --------------------------
* slab() re-written from scratch, resulting in reduced memory footprint and quicker running time
  ! older code based on slab() is likely to now broken- sorry, it won't happen again
  - the new code is much slimmer and based on aggregate() rather than ddply
  - function arguments have changed so be sure to check the manual page
  - user-supplied functions are now much simpler to write and rely on vectors rather than data.frames (= faster)
  - the next major release will contain additional examples of how to use the new features

 
Stress-test the new version of slab()

library(aqp)
library(plyr)
library(lattice)

# generate 5000 random profiles
d <- ldply(1:5000, random_profile, n=c(6, 7, 8), n_prop=5)

# promote to SPC
depths(d) <- id ~ top + bottom

# fake groups
d$group <- sample(letters[1:10], size=length(d), replace=TRUE)

# 80 seconds
system.time(a <- slab(d, fm=group ~ p1 + p2 + p3 + p4 + p5))
a$mid <- with(a, (top + bottom) / 2)

# visual check
xyplot(mid ~ p.q50 | group, groups=variable, upper=a$p.q75, lower=a$p.q25, data=a, ylim=c(180,-5), ylab='Depth (cm)', xlab='', strip=strip.custom(bg='yellow'), as.table=TRUE, panel=panel.depth_function, prepanel=prepanel.depth_function, scales=list(y=list(tick.number=7, alternating=3), x=list(alternating=1, relation='free')), cf=a$contributing_fraction, alpha=0.33, sync.colors=TRUE)