From spencer.graves at structuremonitoring.com  Sat Feb  5 10:38:32 2011
From: spencer.graves at structuremonitoring.com (Spencer Graves)
Date: Sat, 05 Feb 2011 01:38:32 -0800
Subject: [Rd] Reading a specific file during "R CMD check"?
In-Reply-To: <alpine.LFD.2.02.1102050753400.11626@gannet.stats.ox.ac.uk>
References: <4D4CAE8B.9080305@structuremonitoring.com>
	<AANLkTinHL2Cee93GOUP8c9ZbJ_3YRQxVBWZ79ibt-q4V@mail.gmail.com>
	<alpine.LFD.2.02.1102050753400.11626@gannet.stats.ox.ac.uk>
Message-ID: <4D4D1A98.30807@structuremonitoring.com>

       Thanks very much to Hadley and Prof. Ripley for their replies -- 
and my apologies to the list for failing to check my facts before I posted:


       Prof. Ripley's reply was correct:  system.file('rawdata', 
package='testPackage') in a help page in package 'tstPackage' with 
subdirectory 'inst/rawdata' returned 
"~/Rpkgs/tstPackage.Rcheck/tstPackage/rawdata".


       I was once again misled by something I knew that wasn't so.


       Best Wishes,
       Spencer


On 2/5/2011 12:04 AM, Prof Brian Ripley wrote:
> On Fri, 4 Feb 2011, Hadley Wickham wrote:
>
>> Hi Spencer,
>>
>> I think one of the early phases of R CMD check is R CMD install - it
>> installs the package into a special location so that it doesn't
>> override existing installed packages, but still allows function to
>> work exactly as if they were in an installed package.
>
> There first part may or may not be true (it is not for some of the 
> ways 'check' is used on the check farm: consider the --install 
> argument, which is not described in --help), but in every case it will 
> be true that the copy of the package under check is installed in the 
> library at .libPaths()[1], and that installed package is used by 
> 'check' unless the user's code does really odd things (like manipulate 
> .libPaths()).
>
>>
>> Hadley
>>
>> On Fri, Feb 4, 2011 at 7:57 PM, Spencer Graves
>> <spencer.graves at structuremonitoring.com> wrote:
>>> Hello, All:
>>>
>>>
>>>      How can I obtain the location of an example data file in a package
>>> during "R CMD check"?
>>>
>>>
>>>      I want to include sample raw data files in a package and have 
>>> them read
>>> by a function in the package.  It occurs to me to put such a file in
>>> "\inst\rawdata" and have examples find the data using something like
>>> "system.file('rawdata', package='MyPackage')". However, this will 
>>> only work
>>> if the desired data are already in a version of 'MyPackage' that is 
>>> already
>>> installed.  If I change the data, this will return the old data, not 
>>> the
>>> modified.  I've looked at packages RUnit and svUnit, but have not spent
>>> enough time with either to know if they include a solution to this 
>>> problem.
>
> I doubt that the 'problem' is in 'R CMD check', but without a 
> reproducible example, we have no evidence either way.  Certainly 
> plenty of packages use system.file() in their examples, and 'check' 
> works for them even if they are not previously installed.
>
>>>
>>>      Thanks for your help.
>>>      Spencer
>>>
>>> -- 
>>> Spencer Graves, PE, PhD
>>> President and Chief Operating Officer
>>> Structure Inspection and Monitoring, Inc.
>>> 751 Emerson Ct.
>>> San Jos?, CA 95126
>>> ph:  408-655-4567
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>
>>
>>
>> -- 
>> Assistant Professor / Dobelman Family Junior Chair
>> Department of Statistics / Rice University
>> http://had.co.nz/
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>



[Rd] Reading a specific file during "R CMD check"?
Spencer Graves