1

I am trying to configure Apache on my Linux system, but it does not find the correct paths to R packages (and so it does not find the brew package).

I install R packages in ~/R/libs and, when running .libPaths() from an R session I get:

[1] "/home/nico/R/libs"    "/usr/lib/R/library"   "/usr/share/R/library"

However, if I configure RApache to show me RApacheInfo() by using

<Location /RApacheInfo>
SetHandler r-info
</Location>

in .libPaths RApache only reports

/usr/lib/R/library
/usr/share/R/library

How do I tell RApache to go looking in ~/R/libs?

nico
  • 50,859
  • 17
  • 87
  • 112

1 Answers1

1

Per the RApache Configuration Documentation you could try the REvalOnStartup directive to set .libPaths() directly.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Good idea, did not think about it, I'll let you know if it works. Two extra questions: 1. do you know if the discrepancy is normal or is RApache supposed to see also my custom library path? 2. have you specifically seen this pointed out in the docs? I can't seem to find it any mention of libpaths in the docs. – nico May 20 '12 at 16:16
  • If you have a custom path, you have to tell R somewhere and somehow about it. Remember that your user id is typically not the one RApache runs at---so one is better of with $R_HOME/etc/Rprofile.site et al rather than $HOME/.Rprofile. And I put local packages etc into /usr/local/R/site-library rather than in my $HOME for the same reason. – Dirk Eddelbuettel May 20 '12 at 16:32
  • right... now it makes sense, and it works! I like to put packages in home so that I don't have to reinstall them when I update the system. – nico May 20 '12 at 16:48
  • Well I still feel my approach is preferable: /usr/local/lib/R/site-library/ is visible to all users on the system, and not affected by R upgrades via the package manager (as I rely on .deb packages, given that I am maintainer of those for Debian). – Dirk Eddelbuettel May 20 '12 at 16:50