[R] building a package

Duncan Murdoch murdoch.duncan at gmail.com
Tue Feb 11 12:33:22 CET 2014


On 14-02-10 11:45 PM, Cathy Lee Gierke wrote:
> Hi,
>
> I'm building a package in R and not able to find key information for a
> couple of things.
>
> 1.  I have a .png graphic that the R code uses in print-outs it creates.
>   What is the appropriate folder, or manner to incorporate a .png into the
> package?
>
> 2.  I have two .txt data files I want incorporated into the package for
> possible use by users, as well.  When I put them in the data folder, I get
> errors, and they get converted somehow....  What is the proper way to put
> these data files into the package?

You can put arbitrary files into a subdirectory of inst in your package, 
e.g. inst/pngfiles or inst/textfiles.  The subdirectory will be 
installed one level up when your package is installed, so you can't use 
a standard directory name (R, src, etc.), but you can use anything else.

You can find the files from code using system.file().

BTW, questions about package development should be sent to the R-devel 
list.	

Duncan Murdoch

>
> Thanks for your help,
> Cathy Lee Gierke
>
> "Our lives begin to end the day we become silent about things that matter,"
> - Martin Luther King Jr. (1929 - 1968).
>
> 	[[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.
>




More information about the R-help mailing list