[R] Using RSPerl with add-on package ctest and named parameters
Frank Gibbons
fgibbons at hms.harvard.edu
Thu Jun 13 17:42:15 CEST 2002
Hi,.
I've installed RSPerl on my Linux box. It runs all of the test scripts that
I've been able to find. I've learned that I can pass in vectors of data as
array-refs, and can use named parameters with R::callWithNames and a hash
of names and values.
The one problem that I'm left with is how to call a function from an add-on
package ('ctest' in this case). I know that I need to use
R::library("ctest") to load the library. I want to run the following R code
from Perl:
> library(ctest)
> x <- c(1.83, .50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.3)
> y <- c(0.878, 0.647, 0.598, 2.95, 1.06, 1.29, 1.06, 3.14, 1.29)
> wilcox.test(x, y, paired=TRUE, alternative = "greater")
Wilcoxon signed rank test
data: x and y
V = 36, p-value = 0.06445
alternative hypothesis: true mu is greater than 0
I had thought that this should do the job:
#!/usr/bin/perl
use strict;
R::library("RSPerl");
R::library("ctest");
my @x = (1.83, .50, 1.62, 2.48, 1.68, 1.88, 1.55, 3.06, 1.3);
my @y = (0.878, 0.647, 0.598, 2.95, 1.06, 1.29, 1.06, 3.14, 1.29);
R::callWithNames('wilcox.test', {'', \@x, '', \@y, 'alternative', "greater"});
The problem is, it doesn't complain, it doesn't return anything at all.
Shouldn't it print out the results just like the R code does, or does it
return them in an array? I tried catching the return value, by assigning to
a scalar, but get an error:
/usr/bin/perl: relocation error:
/usr/lib/R/library/RSPerl/share/local/lib/perl/5.6.1/auto/R/R.so: undefined
symbol: userLevelConversionToPerl
I know I'm using the right name ('wilcox.test'), since trying other
variations ('wilcox', 'ctest::wilcox') gives me an error message. I'd
really appreciate any suggestions for this problem. I've scoured the web,
and haven't been able to find any examples in which an add-on package
function is called using the RSPerl module.
Thanks,
Frank Gibbons
PhD, Computational Biologist,
Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
Tel: 617-432-3555 Fax:
617-432-3557 http://llama.med.harvard.edu/~fgibbons
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list