[Rd] package check - empty line at end of .R file

Kiermeier, Andreas (PIRSA - SARDI) Kiermeier.Andreas at saugov.sa.gov.au
Wed Feb 23 02:21:46 CET 2005


Dear R-devel members,

I'm in the process of building a package (akmisc) for my own use (Win XP, R
2.0.1 Patched - see details at end).

As I was adding functions (and hence more source .R files) to my package it
got to the point were "R CMD check" failed with the following error (output
has been cut).

* checking S3 generic/method consistency ... WARNING
Error in .try_quietly({ : Error: Unable to load R code in package 'akmisc'
Execution halted
See section 'Generic functions and methods' of the 'Writing R Extensions'
manual.

In an attempt to figure out what went wrong I ran "R CMD INSTALL --build"
and had a look a the file "akmisc" that had been installed in the "akmisc/R"
folder in my default library. The contents of the file ended in (the
function stuff was only for testing)

"plotSymbols" <- function (fn=1) {
  ## Originally by Henrik Bengtsson
  ## modified by Rolf Turner
  ## Posted on R-Help 3 Feb 05
  i <- 0:255
    ncol <- 16
    opar <- par(cex.axis = 0.7, mar = c(3, 3, 3, 3) + 0.1)
    plot(i%%ncol, 1 + i%/%ncol, pch=i, font=fn, xlab = "", ylab = "", 
        axes = FALSE)
    axis(1, at = 0:15)
    axis(2, at = 1:16, labels = 0:15 * 16, las = 2)
    axis(3, at = 0:15)
    axis(4, at = 1:16, labels = 0:15 * 16 + 15, las = 2)
    par(opar)
}"stuff" <-
  function(p){
    return(0)
  }

As it turns out, the source file plotSymbols.R did not end in an empty line,
which caused an error only when there was another file after it (such as
stuff.R - the last file I had just added). I consequently went back to
"Writing R Extensions" (esp 1.1.4 Package subdirectories), but could not
find any comment suggesting that files had to end with an empty line (or
more).

If I missed such a comment then I don't expect a response. But if I haven't
then it may be useful if a comment is included in the documentation to maybe
help others.

Regards,

Andreas




OS: Windows XP
Precompiled R binary (from CRAN)

> version
         _              
platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status   Patched        
major    2              
minor    0.1            
year     2004           
month    11             
day      21             
language R              
>

_____________________________
Dr Andreas Kiermeier
Statistician
SARDI FOOD SAFETY PROGRAM

33 Flemington Street
Glenside   SA   5065
Phone:  +61 8 8207 7884
Fax:       +61 8 8207 7854
Mobile: 0423 028 565

Email: Kiermeier.Andreas at saugov.sa.gov.au
_____________________________

The information in this e-mail and attachments (if any) may be confidential
and/or legally privileged. If you are not the intended recipient, any
disclosure, copying, distribution or action taken is prohibited. SARDI, The
South Australian Research and Development Institute, is the research
division of Primary Industries and Resources (SA)



More information about the R-devel mailing list