[Rd] File name determines success or failure of package installation -- please help

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 8 17:12:13 CET 2009


The order of files does matter when your code has side effects (as here), 
and I guess you did not specify a Collation: field in the DESCRIPTION 
file.

The default order is alphabetic (in the C locale), which is not what you 
want here.

On Thu, 8 Jan 2009, behlingr at gmail.com wrote:

> Synopsis:
> I am trying to build and install a package in R, but I have run into a
> problem where the file names determine success or failure of the package
> installation. I started with a single file containing two class
> definitions. This package installs properly. If I split the classes into
> two files, the build fails. If I simply change the file name of one file
> with no other changes, the build and install then works properly.
>
> This does not seem to be proper behavior.

Why should the results not depend on the order of execution of R 
commands?

> I assume I am doing something wrong, but I have no idea how to debug or 
> fix this problem. Details are

How about looking in the manual ('Writing R Extensions')?

> shown below. I welcome all help and advice!!
> Ron
>
> General Information:
> R version: 2.8.1
> this is an installation of a precomplied version of R
> OS: Windows XP PRO SP2
>> Sys.getlocale()
> [1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"
>
> Details:
> In this example, I start with a file named "classSiteResourceCapacity.R"
> that contains the defintition of two classes shown below.
>
> file=classSiteResourceCapacity.R
> setClass("SiteResourceCapacity",
> representation(
> site = "character",
> siteResource = "character",
> studyResource = "character",
> capacity = "numeric",
> allocation = "matrix",
> priority = "matrix"
> )
> )
>
> setClass("RoleCapacity", representation(loadFactor="numeric"),
> contains="SiteResourceCapacity")
>
>
> The package (containing only this file) works when I run R CMD CHECK or R
> CMD INSTALL.
>
> However, when I seperate the classes into two files with the contents shown
> below (simply split the file contents, no additional changes), CHECK and
> INSTALL now fail as can be seen in the following output.
>
> file=classSiteResourceCapacity.R
> setClass("SiteResourceCapacity",
> representation(
> site = "character",
> siteResource = "character",
> studyResource = "character",
> capacity = "numeric",
> allocation = "matrix",
> priority = "matrix"
> )
> )
>
> file=classRoleCapacity.R
> setClass("RoleCapacity", representation(loadFactor="numeric"),
> contains="SiteResourceCapacity")
>
>
> C:\TEMP>dir Test\R
> Volume in drive C is WINXP
> Volume Serial Number is F893-77D5
>
> Directory of C:\TEMP\Test\R
>
> 01/08/2009 10:11 AM <DIR> .
> 01/08/2009 10:11 AM <DIR> ..
> 01/08/2009 09:54 AM 97 classRoleCapacity.R
> 01/08/2009 09:55 AM 749 classSiteResourceCapacity.R
> 2 File(s) 846 bytes
> 2 Dir(s) 58,195,402,752 bytes free
>
> C:\TEMP>R CMD CHECK Test
> * checking for working pdflatex ...pdflatex: not found
> NO
> * checking for working latex ...latex: not found
> NO
> * using log directory 'C:/TEMP/Test.Rcheck'
> * using R version 2.8.1 (2008-12-22)
> * using session charset: ISO8859-1
> * checking for file 'Test/DESCRIPTION' ... OK
> * this is package 'Test' version '0.1'
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking for .dll and .exe files ... OK
> * checking whether package 'Test' can be installed ... ERROR
> Installation failed.
> See 'C:/TEMP/Test.Rcheck/00install.out' for details.
>
> C:\TEMP>cat 'C:/TEMP/Test.Rcheck/00install.out'
> installing R.css in C:/TEMP/Test.Rcheck
>
>
> ---------- Making package Test ------------
> adding build stamp to DESCRIPTION
> installing R files
> preparing package Test for lazy loading
> Error in reconcilePropertiesAndPrototype(name, slots, prototype,
> superClasses, :
> No definition was found for superclass "SiteResourceCapacity" in the
> specification of class "RoleCapacity"
> Calls: <Anonymous> ... makeClassRepresentation ->
> reconcilePropertiesAndPrototype
> Execution halted
> make[2]: *** [lazyload] Error 1
> make[1]: *** [all] Error 2
> make: *** [pkg-Test] Error 2
> *** Installation of Test failed ***
>
> Removing 'C:/TEMP/Test.Rcheck/Test'
>
> C:\TEMP>R CMD INSTALL Test
> installing to 'c:/PROGRA~1/R/R-2.8.1/library'
>
>
> ---------- Making package Test ------------
> adding build stamp to DESCRIPTION
> installing R files
> preparing package Test for lazy loading
> Error in reconcilePropertiesAndPrototype(name, slots, prototype,
> superClasses, :
> No definition was found for superclass "SiteResourceCapacity" in the
> specification of class "RoleCapacity"
> Calls: <Anonymous> ... makeClassRepresentation ->
> reconcilePropertiesAndPrototype
> Execution halted
> make[2]: *** [lazyload] Error 1
> make[1]: *** [all] Error 2
> make: *** [pkg-Test] Error 2
> *** Installation of Test failed ***
>
> Removing 'c:/PROGRA~1/R/R-2.8.1/library/Test'
> Restoring previous 'c:/PROGRA~1/R/R-2.8.1/library/Test'
>
> Then, if I simply change the name of the file "classSiteResourceCapacity.R"
> to "aR" , keeping the file "classRoleCapacity" and with no change to the
> contents of either file, the package will then pass the CHECK and INSTALL
> properly.
>
> C:\TEMP>dir Test\R
> Volume in drive C is WINXP
> Volume Serial Number is F893-77D5
>
> Directory of C:\TEMP\Test\R
>
> 01/08/2009 10:00 AM <DIR> .
> 01/08/2009 10:00 AM <DIR> ..
> 01/08/2009 09:55 AM 749 aR
> 01/08/2009 09:54 AM 97 classRoleCapacity.R
> 2 File(s) 846 bytes
> 2 Dir(s) 58,195,918,848 bytes free
>
> C:\TEMP>R CMD CHECK Test
> * checking for working pdflatex ...pdflatex: not found
> NO
> * checking for working latex ...latex: not found
> NO
> * using log directory 'C:/TEMP/Test.Rcheck'
> * using R version 2.8.1 (2008-12-22)
> * using session charset: ISO8859-1
> * checking for file 'Test/DESCRIPTION' ... OK
> * this is package 'Test' version '0.1'
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking for .dll and .exe files ... OK
> * checking whether package 'Test' can be installed ... OK
> * checking package directory ... OK
> * checking for portable file names ... OK
> * checking DESCRIPTION meta-information ... OK
> * checking top-level files ... OK
> * checking index information ... OK
> * checking package subdirectories ... OK
> * checking R files for non-ASCII characters ... OK
> * checking R files for syntax errors ... OK
> * checking whether the package can be loaded ... OK
> * checking whether the package can be loaded with stated dependencies ... OK
> * checking for unstated dependencies in R code ... OK
> * checking S3 generic/method consistency ... OK
> * checking replacement functions ... OK
> * checking foreign function calls ... OK
> * checking R code for possible problems ... OK
> * checking for missing documentation entries ... WARNING
> Undocumented S4 classes:
> RoleCapacity SiteResourceCapacity
> All user-level objects in a package (including S4 classes and methods)
> should have documentation entries.
> See the chapter 'Writing R documentation files' in manual 'Writing R
> Extensions'.
>
> WARNING: There was 1 warning, see
> C:/TEMP/Test.Rcheck/00check.log
> for details
>
>
> C:\TEMP>R CMD INSTALL Test
> installing to 'c:/PROGRA~1/R/R-2.8.1/library'
>
>
> ---------- Making package Test ------------
> adding build stamp to DESCRIPTION
> installing R files
> preparing package Test for lazy loading
> no man files in this package
> installing indices
> installing help
> adding MD5 sums
>
> * DONE (Test)
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list