2

my os is debian6,there is a libR.pc after i compile to install R

root@debian:/home/tiger# cat /home/tiger/R-2.15.1/lib/pkgconfig/libR.pc  
rhome=/home/tiger/R-2.15.1/lib/R  
rlibdir=${rhome}/lib  
rincludedir=/home/tiger/R-2.15.1/lib/R/include  
Name: libR  
Description: R as a library  
Version: 2.15.1  
Libs: -L${rlibdir} -lR  
Cflags: -I${rincludedir} -I${rincludedir}  
Libs.private:  

when set R environment in /etc/profile:
R_HOME= /home/tiger/R-2.15.1
or
R_HOME= /home/tiger/R-2.15.1/lib/R
which line will i choose to write in /etc/profile?

Peng Peng
  • 1,305
  • 3
  • 16
  • 20

2 Answers2

1

On a Debian (or derivative such as Ubuntu system) you have /etc/R/ to set variable which R uses:

edd@max:~$ ls -l /etc/R/
total 28
-rw-r--r-- 1 root root  602 Jun 17 20:29 ldpaths
-rw-r--r-- 1 root root 5461 Jun 17 20:29 Makeconf
-rw-r--r-- 1 root root 1868 Mar 31 13:50 Renviron
-rw-r--r-- 1 root root  608 Sep 25  2009 Renviron.site
-rw-r--r-- 1 root root 1159 Mar 31 08:03 repositories
-rw-r--r-- 1 root root  792 Oct 28  2009 Rprofile.site
edd@max:~$ 

and the files in R_HOME/etc/ should be softlinks --- at least if you use the prebuilt binaries. If you build you own binaries, it's your problem.

The file you quote is installed as /usr/lib/pkgconfig/libR.pc on a Debian / Ubuntu system. Setting R_HOME is not needed as R finds its own values (see @flodel's answer).

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
0

On my system:

cat $R_HOME

gives nothing, but inside an R session, I get:

> Sys.getenv("R_HOME")
[1] "/usr/lib/R"

This should tell you two things:

  1. that R_HOME is set at R's startup, so unless you know exactly what you are doing, maybe you don't need to set it up in your /etc/profile.
  2. you can use Sys.getenv to find out the exact path to your R_HOME.
flodel
  • 87,577
  • 21
  • 185
  • 223