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(@_);

In reply to Undefined subroutine error while using R within Perl by rkeshvardoost

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.