[Bioperl-l] data into R from Perl arrays
Fields, Christopher J
cjfields at illinois.edu
Mon Apr 2 12:59:40 UTC 2012
Not sure how well it is supported, but there is also Statistics::useR (which has an XS layer for conversing with R).
https://metacpan.org/module/Statistics::useR
chris
On Apr 2, 2012, at 3:17 AM, Adam Witney wrote:
>
> The quickest way to do this specific example is probably to just save your R commands to a file (eg R_commands.R) and then run some kind of system/exec/backtick function in your perl script to invoke R, something like (untested):
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> system( 'R --file R_commands.R' );
>
> Alternatively if you want perl and R to be able to interact and pass data back and forth, you could use something like Statistics::R
>
> http://search.cpan.org/~fangly/Statistics-R-0.27/lib/Statistics/R.pm
>
> HTH
>
> adam
>
> On 2 Apr 2012, at 06:21, José Ramón Blas Pastor wrote:
>
>> 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
>
>
> _______________________________________________
> 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