Re: Tests of distributions - Installing R (CRAN) packages

Gordon Haverland
 

On Thu, 8 Nov 2018 20:24:08 -0700
"Gordon Haverland" <ghaverla@...> wrote:
install.packages("kSamples")
Talking to myself.

I started a short perl script inside emacs with perldb, which has
use Statistics::R;
and creates the R "object".

I created 2 vectors (lists) that were the same length in Perl, and then
'set' them in R, ask R to multiply them together, and then did a 'get'
of the result. The result printed fine in Perl (in the debugger).

I then asked the R object to load the kSamples library.

$R->run(q`library(kSamples)`);

For those not familiar with Perl, there is a quoting mechanism involved
there (q or qq or others(?)). In this instance, I am quoting with
backticks.

One of the particular tests in kSamples, is the Anderson-Darling test
(which is supposed to be a step or two up from the K-S test). And
running the example from the kSample project at github (or a copy of
it), I did compare the two vectors using the A-D test.

Relatively painless. It is possible to run the test without directing
output anywhere. I am guessing this ends up in some default output
variable? but doing something like:
my $o2 = $R->run(q`ad.test(...)`);
captures the output as a text string into the variable $o2, which can
be printed directly.

--

Gord

Join elug@groups.io to automatically receive all group messages.