[Bioperl-l] data into R from Perl arrays

Gregory Baillie gregonomic at yahoo.co.nz
Tue Apr 3 00:37:38 UTC 2012


Hi.

If you only want to plot histograms (or other kinds of graphs), and don't need to use the statistics capabilities of R, then gnuplot (http://www.gnuplot.info/) is a good option. You can construct a string of gnuplot commands and your data, and pipe that directly to gnuplot, without having to write the commands or data to separate files and then use a system call to R.

Of course, you do have to learn gnuplot, which may be more trouble than it's worth (I like it, but some people don't).

Greg.



________________________________
 From: José Ramón Blas Pastor <joseramonblas at gmail.com>
To: bioperl-l at lists.open-bio.org; Bioperl mailing list <bioperl-l at bioperl.org> 
Sent: Monday, 2 April 2012 3:21 PM
Subject: [Bioperl-l] data into R from Perl arrays
 
Hi,

a very simple doubt, but I do not know how to manage this.

I want to plot a histogram for all data in 'datos.txt'.

a) by using R:
datos<-scan("datos.txt")
pdf("xh.pdf")
hist(datos)
dev.off()


b) How could I invoke R inside Perl to do the same??
#!/usr/bin/perl
open(DAT,"datos.txt");
while (<DAT>) {
chomp;
push(@datos,$_);
}
#now I want a histogram of values in @datos

Thanks!!

JR

-- 
José Ramón Blas - PhD
Dept. Biochemistry - Medicine School
University of Castilla-La Mancha
C Almansa, 14
02006 Albacete (Spain)

Phone: +34 967599200 ext. 2958

_______________________________________________
Bioperl-l mailing list
Bioperl-l at lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/bioperl-l



More information about the Bioperl-l mailing list