[GRASS-dev] adding lib_arraystats

Dylan Beaudette dylan.beaudette at gmail.com
Thu Apr 17 15:28:44 EDT 2008


On Wednesday 13 February 2008, Moritz Lennert wrote:
> On 12/02/08 03:43, Dylan Beaudette wrote:
> > On Monday 11 February 2008, Moritz Lennert wrote:
> >> Hello,
> >>
> >> I've finally gotten around to continue working on the d.thematic.*
> >> modules, and more specifically on the classification code. As mentioned
> >> earlier, I think it makes sense to make the latter into a library, so I
> >> decided to create lib_arraystats which contains functions for collecting
> >> basic statistics and for finding class breaks in arrays of doubles. In
> >> the future this could be filled with more statistical functions on such
> >> arrays.
> >>
> >> Could the gurus please have a look and tell me if the attached files are
> >> decent enough (except for the lacking documentation) to be committed to
> >> svn for further development ? Once that's done, I can also commit the
> >> d.thematic.area and v.class modules.
> >>
> >> Moritz
> >
> > Nice work Moritz.
> >
> > On this thread-- it would be neat if we can use (along side Moritz's and
> > existinf stat libs) the shared R library, when available. I think that it
> > would have to be a compile-time option, and the user would have to have R
> > installed, and compiled with the '--enable-R-shlib' flag. This would
> > allow us to switch between the default, basic set of algorithms, and the
> > entire suite of R codes. Some of these functions might not work with huge
> > datasets (R works with data in-memory)-- but it would allow us to program
> > more complicated algorithms without re-inventing them.
>
> I agree that having a more direct link to R would be nice. At the same,
> I'm not sure if we should do this across all modules using stats. Maybe
> a g.rstats or v.rstats could be an option ?

A follow-up:

instead of linking to the R libs, we could use something like:

Rscript --vanilla --slave --default-packages=stats -e 'mean(rnorm(100))'

via some kind of system() function, to access R in a simple and relatively 
fast way.

Dylan


>
> > This thread reminded me of doing this, as sometimes it is useful to look
> > for "natural classes" within data. Instead of re-implementing a variation
> > of K-means, we could just pass an array to the appropriate (set of) R
> > functions.
>
> I've done this, but via the plr interface between R and PostgreSQL. See
> attached script for an example.
>
> Moritz



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341


More information about the grass-dev mailing list