Skip to content

aqp 1.25

Compare
Choose a tag to compare
@dylanbeaudette dylanbeaudette released this 21 Oct 18:13
· 1369 commits to master since this release

This release of aqp marks a significant step towards major changes planed for version 2.0. Since 1.17, there have been major changes to the internals of the SoilProfileCollection object (thanks to @brownag) and associated methods. We expect some evolution (but less drastic as compared to the previous release) before version 2.0.

See NEWS.md for a complete listing of changes.

Important Changes

  • estimateSoilDepth loses top and bottom arguments, these are automatically extracted
  • combine replaces/expands aqp::union due to conflicts with base::union
  • split receives some upgrades to the S4 definition to increase parity with split.default
  • filter is now an alias for new method subset, which mirrors base::subset
  • default horizon ID (hzID) is now a character data type

Enhancements

SoilProfileCollection Internals

  • new function duplicate will makes copies of profiles within a SoilProfileCollection
  • two new SoilProfileCollection wrapper methods: munsell2SPC, spc2mpspline
  • improvements to glom(..., invert=TRUE), glomApply, and better tests
  • new wrapper method around glomApply: trunc for cases when top and bottom depth interval is the same for all profiles in a SoilProfileCollection
  • enhanced SoilProfileCollection object validity checks via S4; new method spc_in_sync (#152)
  • optimization of [ subset method and optional use of data.table (#155)
  • depths<- has been optimized and minimally validates input data
  • combine uses depths<- internally; explicitly enforcing profile ID + top depth order in horizon data is safer but results in different ordering if union-ing IDs that "intermingle" (need to be re-sorted).
  • new experimental method is permute_profile; similar to sim but for boundaries. The interface to this function is likely to change/be expanded.
  • basic support for promotion of tbl_df and data.table to SoilProfileCollection
  • new method aqp_df_class to determine class name in use in a SoilProfileCollection object
  • optimization of [i,] [,j] subset methods for data.frame-based slots (#135)
  • new verbs: mutate, mutate_profile (#118)
  • define [[ subsetting method; an "ambivalent" accessor for site- or horizon-level properties
  • new subset verbs grepSPC, filter, subApply for use in %>%-lines

Color / Visualization

  • simulate subtractive mixtures of Munsell colors with mixMunsell
    • see companion function plotColorMixture for visualization of spectra / mixture
  • complete overhaul of textureTriangleSummary:
    • uses soiltexture package for visualization (plotrix implementation dropped)
    • argument names changes (! may break old code, sorry)
    • dropped simulation via sim = TRUE argument, see bootstrapSoilTexture for a better approach
  • new function bootstrapSoilTexture for simulating realistic sand/silt/clay compositions
  • add returnData argument to contrastChart
  • plotSPC upgrades (#146)

Everything Else

Additions

Bug Fixes

  • fix for routing of NULL through $<- and horizons<- or site<- (#163)
  • fix handling of missing metadata in (old) serialized SoilProfileCollection objects
  • fix for promotion of data.table with character vector (not formula) interface
  • fix for unit-length and zero-length legends in plotSPC
  • fix for plot generic to show aqp::plot in ?plot
  • fix for getSurfaceHorizonDepth with buried horizons / non-contiguous instances of matching horizons (#132)
  • fix for default plotSPC with small number of profiles (#128)
  • remove implicit conversion to SpatialPointsDataFrame with unit-length [ j-index subset ((#125)
  • fix in slab when slab.structure[2] > max(x)

New Compatibility with Pipe-based Workflows!

The SoilProfileCollection object is now compatible with {magrittr} pipe %>% based workflows. Here is an example using select soil morphologic data from Jacobs (2002) "Redoximorphic Features as Indicators of Seasonal Saturation, Lowndes County, Georgia", a sample dataset available in {aqp} (jacobs2000)

# {aqp} + {magrittr} pipes
library(aqp)
library(magrittr)

# see ?jacobs2000 for details
data("jacobs2000", package = "aqp") 

# create a base plot to inspect full dataset
par(mar=c(0,0,0,2))
plot(jacobs2000, color = "matrix_color", 
     plot.order = order(jacobs2000$time_saturated))

# select 3 profiles along gradient, and truncate 50-150cm interval
jacobs.sub <- jacobs2000 %>% 
                subset(profile_id(.) %in% c("92-2","92-4",'92-7')) %>%
                trunc(50, 150)

# create a base plot
plot(jacobs.sub, color = "matrix_color")

# add redox concentrations
jacobs.sub %>% addVolumeFraction('concentration_pct', 
                     col = .$concentration_color, 
                     pch = 16, cex.max = 1)

# add redox depletions 
jacobs.sub %>% addVolumeFraction('depletion_pct', 
                     col = .$depletion_color, 
                     pch = 16, cex.max = 1)

image