Howdy anikng, and welcome to the Monastery!
I'm not familiar with R, but if you can't use non-core modules, this page suggests that you can invoke R like this to execute commands from a file:
R CMD BATCH /path/to/file.R
Alternatively, there is a module, Statistics::R, to interface R with Perl. So if installing that is an option, you could also do this:
use Statistics::R;
my $R = Statistics::R->new();
my $csvfile = "C:/Users/Anil/Desktop/sam.csv";
my @R_commands = (
'library(gplots)',
'library(RColorBrewer)',
"all.data <- read.csv($csvfile)",
'row.names(all.data) <- all.data$sample'
'all.data <- all.data[, -1]'
'data.prop <- all.data/rowSums(all.data)',
'scaleyellowred <- colorRampPalette(c("lightyellow", "red"), space
+ = "rgb")(100)',
'heatmap(as.matrix(data.prop), Rowv = NA, Colv = NA, col = scaleye
+llowred)'
);
$R->run(@R_commands);
$R->stop();
Totally untested, though.
There's also a ->run_from_file() method if you'd rather read commands from an external file than embedding them in your Perl script.
|