R CMD build error with data files
Christian, my late answer on this one:
On 21.08.2012 22:28, Christian Hennig wrote:
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")).
Not sure why that worked before, at least I am surprised it did; You have to have the package already installed before building it so that R can find the mentioned files. I's suggest to generate .RData files anyway.
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!
Not sure why this fails for you. We need the LaTeX output for further analysis of the problem. Best, Uwe
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
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.