blogs

Modeling an Infant's Feeding Schedule with Periodic Smoothing Splines

Submitted by dylan on Sat, 2013-06-15 22:23.

Feeding ScheduleFeeding Schedule

While on paternity leave I had an opportunity to test out periodic smoothing splines (within the framework of generalized additive models) on an interesting time-series-- an infant's feeding schedule.

( categories: )

Hillslope Position by Soil Series

Submitted by dylan on Wed, 2013-06-05 18:34.

Soil survey data are typically built upon a foundation of soil-landscape relationships that have been verified in the field.

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.

SoilWeb Updates

Submitted by dylan on Sat, 2013-02-09 00:16.

New Label StyleNew Label Style!

Some recent updates to SoilWeb. New visualizations will be incorporated into SoilWeb soon.

Visualizing CA Snow Survey Data in R

Submitted by dylan on Mon, 2013-01-14 19:13.

The CDEC website provides access to a wide range in hydrologic data (stream flow, snow survey, etc.) collected in California. The following code and functions (attached at the bottom of the page) illustrate how to query CDEC, and graphically compare the May 2011 snow survey data with the historic record at 15 sites. Data in this format lend well to the "split-apply-combine" strategy. Integration of several figures (scatter plot, custom box-whisker plot) and graphical legend for bwplot is accomplished via the latticeExtra package. See in-line comments below for a more complete description of the code.

CA Snow SurveyCA Snow Survey

 
Note that snow water equivalent (SWE) from May 2011 (blue dots) is compared with the historic record (box-whisker plots) for the months of Jan-May. Pretty impressive snowfall!

( categories: )

New AQP Tutorials

Submitted by dylan on Fri, 2013-01-04 22:17.

Soil Series ExtentSoil Series Extent

Several new AQP-related tutorials have been posted to the R-Forge project page.

  1. SoilProfileCollection class/method documentation
  2. soil series extent mapping examples
( categories: )

Basic Simulation of Soil Profile Data in R via AQP

Submitted by dylan on Wed, 2012-12-19 18:59.

Something fun to play with before the new year: experimental code in aqp for simulating soil profile data from a single "template" profile. The basic idea: simulate horizon thickness data using a family of Gaussian functions with mean defined by horizon thickness values found in the template and standard deviation defined by the user. Larger hz.sd values will yield more drastic variation in the simulated results. Note that only "horizonation" (e.g. the sequence of horizons and their respective thickness) is simulated; horizon attributes (e.g. texture, pH, etc.) are copied from the "template" profile.

Basic usage is demonstrated below, see package manual page for details. This function is only available in the version of aqp hosted by R-Forge. It should be on CRAN by the new year.

Simulated ProfilesSimulated Profiles

Automated OSD Lookup and Display via SoilWeb and AQP

Submitted by dylan on Thu, 2012-11-08 00:06.

Automated OSD lookup and displayAutomated OSD lookup and display

 
UPDATED 2013-04-08


This functionality it now available in the soilDB and sharpshootR packages. All code on this page is now superseded by the fetchOSD() and SoilTaxonomyDendrogram() functions.

 
UPDATED 2012-11-07

I have been thinking about a URL-based interface to basic Official Soil Series Description (OSD) data for a while now... something that when fed a URL, would return CSV-formatted records to the calling process. These type of interfaces can later be used to support more complicated systems, such as our smartphone interface to SoilWeb. URLs can be accessed like files in R, making it possible to do something like this:

Summarizing Circular Data in R: Aspect Angle

Submitted by dylan on Wed, 2012-10-10 15:26.

The orientation of terrain surface (aspect) can have dramatic effects on landscape-scale variation in soil temperature and moisture. Summarizing aspect angle is complicated by the fact that sampled values are measured on a circular scale. The circular package for R can be used to summarize, model, and visualize this type of data.

An example function is presented below that demonstrates several components of the circular package: special data structures, summary functions, plotting functions and their application to circular data derived from measurements collected by compass. Spread and central tendency are depicted with a combination of circular histogram and kernel density estimate. The circular mean, and relative confidence in that mean are depicted with an arrow: longer arrow lengths correspond to greater confidence in the mean.

Circular HistogramCircular Histogram

Compiling Source Packages on R 2.15.x / Mac OS 10.5.x

Submitted by dylan on Fri, 2012-08-31 20:45.

For some reason R is not happy with its 64-bit cousin when installing source packages:

* installing *source* package ‘XMLSchema’ ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
*** arch - x86_64
/Library/Frameworks/R.framework/Resources/bin/R: line 259: /Library/Frameworks/R.framework/Resources/bin/exec/x86_64/R: Bad CPU type in executable
/Library/Frameworks/R.framework/Resources/bin/R: line 259: /Library/Frameworks/R.framework/Resources/bin/exec/x86_64/R: Unknown error: 0
ERROR: loading failed for ‘x86_64’
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/XMLSchema’

Quick hack to get things moving along: throw out the 64-bit binary, located at:

rm -rf /Library/Frameworks/R.framework/Resources/bin/exec/x86_64/