in reply to Calling R in Perl using RSPerl

I know you said R is installed correctly, but...
can you do this first RFromPerl.html ? (search for "libR.so")
Most probable cause: Try checking if you have a shared library:

Note also that to use the R-in-Perl mechanism one must have built R as + a shared library. (This is not necessary when calling Perl from R.) +You can check if this has been done by checking to see if libR is in +the directory $R_HOME/lib/. If this is not there, you are advised to +clean the entire R distribution (with make distclean) so as to start +from scratch and then configure and compile R using the --enable-R-sh +lib to R's configuration script.

From a Perl perspective, See also: Re: Can't locate loadable object for module X in @INC (@INC contains: ... )
Addendum: If not, search your harddisk for R.pm, and hack the INC with it:
BEGIN { unshift @INC, "/usr/local/src/RSPerl/"; ## include lib };

But I am sure that in the html page, there is something you need to re-do to get the paths working without hacking them.

note: you NEED to use the unshift inside that BEGIN block (it executes before all else, thus assuring the @INC is set before it uh... begins... processing your "use R;" statement).

Replies are listed 'Best First'.
Re^2: Calling R in Perl using RSPerl
by rkeshvardoost (Novice) on Jan 10, 2016 at 17:48 UTC
    Hi! Thank you for the suggestion. I have built R as a shared library and the following shows its location: /usr/lib64/R/lib/libR.so /usr/lib64/R/lib/libRblas.so /usr/lib64/R/lib/libRlapack.so What do you think I should do now?

      Add /usr/lib64/R/lib/ to your @INC with the code mentioned before. And also check where R.pm is in, add that path too. You can use multiple unshift commands in that BEGIN block. Outside the block, do a "use R;" and see if that runs without errors.

      BEGIN { unshift @INC, "/usr/lib64/R/lib/"; # unshift @INC, "/other/path/"; # if required }; use R;


      But maybe this works now (this is a use R; without any other code)
      use R;

        Thank you! That error is solved.

        Now I get another error:

        Undefined subroutine &R::startR called at ...

        The following is the part of the code the error is related to

        use R; &R::startR("--silent"); "X11" to simply pull up on screen R::call("pdf");