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

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Feb 23 08:31:23 CET 2005


R files do not have to end in an empty line, but lines do have to end in a 
line terminator (but two are not needed).  That is your problem: the last 
line of your file is unterminated.

R-devel (2.1.0-to-be) has the comment

     # use fast version of file.append that ensure LF between files

so this already has a workaround in that version.

Remember that in R commands are separated by newline or ;  so you need 
complete lines in files.  You may be able to adjust your editor to ensure 
this.


On Wed, 23 Feb 2005, Kiermeier, Andreas (PIRSA - SARDI) wrote:

> 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)
>
> ______________________________________________
> R-devel at stat.math.ethz.ch 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