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

Florence Combes fcombes at gmail.com
Thu May 19 16:39:26 CEST 2005


Dear Duncan, 

Thanks a lot for your answer. 


> 
>   The thing that comes to mind initially is an issue with the
> event loop.  Perl is not running an X windows event loop,
> so not all the updates, refreshes, and drawing events are
> being processed.   R is processing some of them in the
> drawing calls, but after that R does not get an opportunity
> to process any more.
> 
>  As I say, this is just a guess.  To validate it, try using
> a non-interactive graphics device such as pdf, e.g.
> 
> 
> &R::call('pdf', 'foo.pdf');
> 
> 
> &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)) );
> 
> &R::call('dev.off');
> 
> And then examine that file to ensure it has the lines.

it is impossible for me to obtain the pdf file....
and I still have the same error message due to segmentation problem
after the "Performed the call, result has length 7".

Can't understand what's happening....

Thanks, 

Florence. 

> If it does, then it is an issue with the interactive
> device and the event loop is almost definitely the problem.
> 
> How to fix things if the event loop is the problem  is
> not trivial and there are many possible different situations
> to consider.
> 
>  D.
> 
> 
> Florence Combes wrote:
> > 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 at 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
> 
> --
> Duncan Temple Lang                duncan at wald.ucdavis.edu
> Department of Statistics          work:  (530) 752-4782
> 371 Kerr Hall                     fax:   (530) 752-7099
> One Shields Ave.
> University of California at Davis
> Davis, CA 95616, USA
> 
> 
> 
> 
> 
>




More information about the R-help mailing list