From murdoch.duncan at gmail.com  Mon Sep 27 17:31:22 2010
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Mon, 27 Sep 2010 11:31:22 -0400
Subject: [Rd] Incorporate graphic files into R-package
In-Reply-To: <1285598696018-2715520.post@n4.nabble.com>
References: <1285598696018-2715520.post@n4.nabble.com>
Message-ID: <4CA0B8CA.1040807@gmail.com>

  On 27/09/2010 10:44 AM, elgorgonzola wrote:
> Hi,
>
> I am working on a package which will be used to generate reports using
> Sweave. The createReport() function should create a folder and Rnw/tex-files
> automatically. The reports should, however, also feature the company logo. I
> don't want to have to manually copy the image file into the folder each time
> a report is created. I don't know if it is possible or not but I would like
> to somehow store the graphic-file within the package and have the
> createReport() automatically copy it to the appropriate folder. Does anyone
> have an idea how this could be achieved?
> I'm thinking of something similar to the way data is stored as a RData-file
> in the data-path of a package and is accessed via load() once the package is
> loaded.
>
> Thanks in advance and hava a great day.

Read about the "inst" directory in Writing R Extensions.  You can put 
your logo there, it will be installed when your package is installed, 
and your Sweave document can find it using system.file("path within 
package", package="yourpackage") to copy to the output directory.

Duncan Murdoch



[Rd] Incorporate graphic files into R-package
Duncan Murdoch