[Bioc-devel] package vignette error : external data can't be captured when compiling package vignette

Hervé Pagès hpages at fredhutch.org
Fri Dec 2 02:04:55 CET 2016


Hi,

Make sure you understand the difference between the *package source
tree*, which you control and where you must create the inst/ folder,
and the *package installation folder*, which gets created and
populated by 'R CMD INSTALL'. The exact location of the *package
installation folder* doesn't really matter but if you are curious
you can use the .libPaths() command to see it. The *package installation
folder* is the subfolder of .libPaths() that has the name of the
package. You can also see it with find.package("mypackage").

During installation, everything that is under the inst/ folder will
get installed *directly* under the *package installation folder*.
So if you created the extdata/ folder under inst/ (as it should be),
extdata/ will end up being installed at .libPaths()/mypackage/extdata/
The code in your examples can get the path to the *installed* extdata/
folder with

   system.file(package="mypackage", "extdata")

or get the path to any file under extdata/ with e.g.

   system.file(package="mypackage", "extdata", "data1.bed")

Don't do

   system.file(package="mypackage", "extdata/data1.bed")

even if it works for you because it's not portable (the use of / as
a separator is a platform-dependent thing).

Finally note that you should never try to modify anything that is under
.libPaths() by hand. Furthermore, and that's a mistake we see sometimes
with contributed packages, the code in your package should always
treat the *package installation folder* as a read-only folder.

Hope this helps,

H.


On 12/01/2016 04:34 PM, Jurat Shayidin wrote:
> Hi BiocDevel :
>
> I am getting vignette error when I building my packages, and external data
> can't be captured by system.file() . I did unit test all function of my
> packages, it works fine. When I am going to compile package vignette, test
> input bed file can't be detected. However, I used devtools::install()command
> to install my packages, but installation directory inst/ was not created
> automatically. By R package convention, all external data must be located
> in inst/, so I manually created this folder  inst/extdata and paste my
> data, but vignette compilation still failed. According to convention of R
> package, my package structure will be:
>
> myPackage
> `- inst
> `- extdata
> `- data1.bed
> `- data2.bed
> `- R
> `- ...
> `- NAMESPACE
> `- DESCRIPTION
>

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioc-devel mailing list