Clear questions and runnable code
get the best and fastest answer
Re^2: Calling R in perlby blackzero (Acolyte)
|on Dec 16, 2012 at 12:52 UTC||Need Help??|
Ok, thank you very much to all for the replies. Statistics::R seens to be what I want.
I've installed Statistics::R
But I have some issues.
My code is this:
data_freq.txt is this:
I run my program with "./perl-R3.pl data_freq.txt". I am able to call R, activate the genetics package, make it run the file data_freq.txt.out, do the calculations, save the results in "g1.txt" and "meang1.txt".
But I cant get back g1 to perl.
If I uncomment the line "#my @results1 = get('g1');", I get this error:Undefined subroutine &main::get called at ./perl-R3.pl line 35.
If I try to pass values from perl to R directly with a command like "$R -> set('table', \@lines);", I also receive an error:Can't locate object method "set" via package "Statistics::R" at ./perl-R3.pl line ##
Whats the problem here?
Also, if I try to set the work directory to R with a command like "$R -> send('setwd("/home/user/my_path/");');", the program hangs.