From edd at debian.org  Mon Sep  9 15:41:42 2013
From: edd at debian.org (Dirk Eddelbuettel)
Date: Mon, 9 Sep 2013 08:41:42 -0500
Subject: [Rd] Package installation and path.package
In-Reply-To: <D2208CD6-8CA6-4A21-A112-9CE4E3BA1587@r-project.org>
References: <79265780-D119-450A-93F9-D5BA2A81C9B1@uni-bonn.de>
	<D2208CD6-8CA6-4A21-A112-9CE4E3BA1587@r-project.org>
Message-ID: <21037.53270.901095.347497@max.nulle.part>


On 9 September 2013 at 09:26, Simon Urbanek wrote:
| On Sep 9, 2013, at 4:22 AM, Simon Zehnder wrote:
| > I am writing right now my own package that makes use of 'tempfile' and
| > there within with 'path.package'. When I install it, I get the error: Error
| > in path.package("mypackage") : none of the packages are loaded. Here is the
| > code, I use in my package:
[...]
| That path to your package is dynamic - in general it will not be know when
| creating the lazy-load DB, so you really want to put that code in .onLoad()
| where the path is known. 

And you may want to use   system.file()   rather than path.package(), at
least if I understand the question right.

Here is what I use to share the bibtex file for the Rcpp vignettes with other
Rcpp* package vignettes:

   R> system.file(package="Rcpp", "doc", "Rcpp.bib")
   [1] "/usr/local/lib/R/site-library/Rcpp/doc/Rcpp.bib"
   R> 

Answer conditional on my particular Linux system, but the path is guaranteed
to be valid as long as Rcpp is installed which one can ensure via Depends:
from another package.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com



[Rd] Package installation and path.package
Dirk Eddelbuettel