En esta sección veremos como se puede utilizar el poderoso ambiente de programación estadística R, que tantas aplicaciones tiene en el tratamiento estadístico de datos, incluyendo datos biológicos y *ómicos. Para ello debes descargar e instalar el paquete RSPerl, con dos sencillos pasos:
./configure --enable-R-shlib make
tar zxf RSPerl_0.9-0.tar.gz
seguido de
R CMD INSTALL --configure-args='--with-in-perl' RSPerl
use lib "/path/to/R-2.5.0/library/RSPerl/perl/i386-linux";
En el siguiente programa muestro un ejemplo:
#!/usr/bin/perl -w use strict; use lib "/path/to/R-2.5.0/library/RSPerl/perl/i386-linux/"; use R; use RReferences; R::initR("--silent"); R::library("RSPerl"); # input data my @x = (44.4, 35.9, 41.9, 100.3, 60.7, 84.1, 105.7, 45.2, 60.1); my @y = ( 2.2, 1.7, 2.0, 5.0, 3.6, 4.0, 5.2, 2.8, 3.8); # correlation my $test = "spearman"; my $corr = R::callWithNames("cor.test",{'x'=>\@x,'y'=>\@y,'method'=>"$test"});#pearson,spearman my $corr_coef = $corr->getEl("estimate"); # hacer edit(corr) en R para ver sus atributos my $pvalue = $corr->getEl("p.value"); print "# $test : coef=$corr_coef p=$pvalue (h0: coef==0)\n"; # plot scatterplot & regression line my $plotfile = "corr.png"; my $dataframe = R::callWithNames("data.frame", {'x', \@x, 'y', \@y}); my $linearfit = R::call("lm","y~x",$dataframe); R::call("png","$plotfile"); R::callWithNames("plot", {'x',\@x,'y',\@y,'ylab'=>'y','xlab'=>'x','main'=>'title'}); R::call("abline",$linearfit); R::call("dev.off");