working version with caching.

however, the cran-check takes too long, b/c the R code is being run.
so I will have to hack together something on my own which looks for
precomputed data. bleah.