Skip to content
Back to formatted view

Raw Message

Message-ID: <4DAD7D81.7020702@statistik.tu-dortmund.de>
Date: 2011-04-19T12:18:09Z
From: Uwe Ligges
Subject: Which should I use? system.file() path.package() find.package()
In-Reply-To: <BANLkTikxQDDwjS3Hs7VMyUgA4NdZUxXZ3A@mail.gmail.com>

On 19.04.2011 05:19, Kevin Wright wrote:
> For a package that I am creating, I have some files in the "inst"
> directory.  In the package man pages, I want to have R code that accesses
> these files.
>
> As of R-2.13.0, it looks like I can use any of: system.file() path.package()
> find.package()
>
> There are some differences between these functions, so I am wondering, is
> there is a preferred approach?

find.package() is the worst one: It will access all installed packages, 
that may be thousands and takes minutes...

path.package() is a non backward compatible function that makes use of 
system.file() and does not support to construct the full path to the 
file with one call.

Since you know the package is there after your loaded it successfully, 
just use

system.file()


Uwe Ligges


>
> Kevin Wright
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.