[R] R from Perl -- RSPerl and lines function.

From: Florence Combes <fcombes_at_gmail.com>
Date: Thu 19 May 2005 - 21:57:56 EST


Dear R-helpers,

I am running well Perl and R on my Debian Linux, and I tried RSPerl. Installation is ok and all simple functions run well. But I have a problem to call the "lines" function.
I would like to draw an histogram with the density curve on. Is is OK in R with the command:

>x<-rnorm(1000)
>hist(x,prob=T)
>lines(density(x))

for example.

Now, I have a Perl script with which pars files, and I obtain data in a list @distance. I draw an hist with RSPerl command (from Perl):



(---Perl script---)

&R::initR("--silent");
&R::library("RSPerl");
@Rdata=&R::call("as.numeric", \@distance);

&R::callWithNames("hist", {'', \@Rdata, 'main', '', 'xlab', "Distribution of the distances between oligo-5' and sequence 3'", 'br', 15, 'col', 'gray', 'prob', 'T'} );

&R::call("lines", ("density", \@Rdata)) );

sleep(4);

&R::call("dev.off");

exit;


All runs well: I obtained the histogram graph, and it seems that the density call runs well since I have the message "Performed the call, result has length 7" and I read the density fuction results in 7 parameters; but just after I have a message like "segmentation fault".

I cannot understand what happens ?

Has someone already encountered this problem or know how to abtain an histogram and the density line with RSPerl ???

Thanks a lot for your help, caus I tried all I could think of ...

Florence.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu May 19 22:08:41 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:51 EST