[R] R CMD build error with data files

Christian Hennig ucakche at ucl.ac.uk
Tue Aug 21 22:28:00 CEST 2012


Dear list,

I want to update my prabclus package which I haven't done for quite a 
while.

In the previous version, I had .dat files in my data subdirectory, which I 
read using .R files. Now R CMD check gives me a warning that .dat files 
are no longer accepted there.

So I changed my filenames to .txt, but actually some of these files are 
only there in order to be read by .R, not in order to be read independetly 
by read.table, which produces an error (something like "scan error: line 5 
does not have 2 elements", which I'd guess comes from the fact that R 
tries to automatically read the file with read.table that should be read 
in a different way as specified in my .R-file).

So I decided, following the advice in "Writing R extensions", to put these 
files into a directory called inst/extdata.
The data directory now only has .R-files that read stuff from files in 
inst/extdata.
This, unfortunately, doesn't seem to work.
For example,
kykladspecreg.R in data has one line reading
kykladspecreg <- 
read.table(system.file("extdata","kykladspecreg.txt",package="prabclus")).

R CMD build gives
Warning in file(file, "rt") :
   file("") only supports open = "w+" and open = "w+b": using the former
Error in read.table(system.file("extdata", "kykladspecreg.txt", package = 
"prabclus")) :
   no lines available in input

Same if I use 
read.table(system.file("inst","extdata","kykladspecreg.txt",package="prabclus"))

What's wrong here?
Now what to do with the files to be read by the R-files?
In the old days all was fine having them as dat files in the data 
directory. :-(

By the way, R CMD check also produces a warning
"* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems."
...with no useful hint what the problemn may be whatsoever. If anyone has 
an idea how to find the problem, please tell me!

Thanks,
Christian



*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
chrish at stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche



More information about the R-help mailing list