rkeshvardoost has asked for the wisdom of the Perl Monks concerning the following question:
Hi everyone,
I am trying to use R within perl with the following code :
use R; #Allows use of R references called between Perl and R use RReferences; package R; package R::startR; use lib 'R'; use Exporter 'import'; @EXPORT_OK = qw(startR AUTOLOAD); &R::startR("--silent"); R::call("pdf");
but I keep getting this error:
Undefined subroutine &R::startR called at ...
Here is a part of my R.pm code:
package R; use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); use Carp; require Exporter; require DynaLoader; require AutoLoader; @ISA = qw(Exporter DynaLoader); # Items to export into callers namespace by default. Note: do not expo +rt # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. @EXPORT = qw(startR AUTOLOAD ); $VERSION = '0.01'; bootstrap R $VERSION; # Preloaded methods go here. sub startR { # If R_HOME is not in the environment table, put in the value from + # the installation probes. initR(@_); return(1); } # This used to be a native routine. This is now here to maintain the A +PI # but we slide in code to set the R_HOME variable if need be. sub initR { if(0) { croak("no support for R embedded within Perl"); } setRHome(); initRSession(@_);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Undefined subroutine error while using R within Perl
by kcott (Archbishop) on Jan 13, 2016 at 21:51 UTC | |
by rkeshvardoost (Novice) on Jan 13, 2016 at 23:46 UTC | |
by kcott (Archbishop) on Jan 14, 2016 at 06:25 UTC | |
|
Re: Undefined subroutine error while using R within Perl
by Mr. Muskrat (Canon) on Jan 14, 2016 at 16:04 UTC |