[R] My_first_R_package: almost there

Friedrich Leisch
Tue, 26 Jun 2001 12:17:52 -0000

>>>>> On Tue, 26 Jun 2001 14:10:00 +0200 (MET DST),
>>>>> Agustin Lobo (AL) wrote:

  > Well, thanks to you all
  > I''ve been able to install my first
  > little package. I''ve dumped
  > some of my Splus(PC) functions
  > to an ascii file (*.R), created
  > the directory structure and the
  > DESCRIPTION and INDEX files. Then
  > I checked and installed with:

  > R CMD INSTALL -l ~/.R/library Sutilpangea

This is not a good idea, because the .R directory is a *temporary*
directory that R uses (on unix), and basically is created newly every
time you do help.start(), so your package will get deleted if you
install it there.

A typical place for private packages would be $HOME/lib/R but of
course you''re free to use any place you like (except .R :-)


  > because I found that I have an .R directory
  > in my home where a subdirectory .R/library
  > has links to where the packages really are
  > (/usr/lib/R/library). Therefore, I decided
  > to keep  my own packages in .R/library
  > while the CRAN packages really stay in
  > /usr/lib/R/library.

  > Now the only problem is that, by default, R
  > searches packages in /usr/lib/R/library
  > because of the value of R_HOME:

  >> system ("echo $R_HOME")
  > /usr/lib/R

  > It would be better if R would
  > search packages in my .R/library
  > directory, where R would find both my packages
  > and the links for the CRAN packages.
  > How can I change the deafault searching
  > path for the packages? (I know
  > I can always do library(xxx, lib.loc="/home/alobo/.R/library"),
  > but it would be nicer having this as default).

One possible way to solve this problem: R searches all libraries in
the environment variable R_LIBS, please read the documentation.

Hope this helps,

--
-------------------------------------------------------------------
                        Friedrich  Leisch
Institut f?r Statistik                     Tel: (+43 1) 58801 10715
Technische Universit?t Wien                Fax: (+43 1) 58801 10798
Wiedner Hauptstra?e 8-10/1071      Friedrich.Leisch at ci.tuwien.ac.at
A-1040 Wien, Austria             http://www.ci.tuwien.ac.at/~leisch
-------------------------------------------------------------------