介紹:perl子程序: 調(diào)用R中fisher檢驗(yàn)
sub fisher {
my ($a, $b, $c, $d, $result) = @_;
##########################################
## Mem Women
##Dieting a c
##Non-dieting b d
my $tmpOut = "xxxtmpOut.R";
open OUTZZZ, ">$tmpOut";
print OUTZZZ 'x <- matrix('."c($a, $b, $c, $d)".',ncol=2,nrow=2)', "\n";
print OUTZZZ 'fisher.test(x)$p.value', "\n";
close OUTZZZ;
my $line = `Rscript $tmpOut`;
if($line =~ /\s+(\S+)\n/){
$$result = $1;
}
}