[R] Building package - tab delimited example data issue

Berwin A Turlach berwin at maths.uwa.edu.au
Thu Dec 6 12:19:41 CET 2007

G'day Peter,

On Thu, 06 Dec 2007 11:52:46 +0100
Peter Dalgaard <P.Dalgaard at biostat.ku.dk> wrote:
> If you had looked at help(data), you would have found a list of which
> file formats it supports and how they are read. Hint: TAB-delimited
> files are not among them. [...]

On the other hand, "Writing R Extensions" has stated since a long time
(and still does):

The @file{data} subdirectory is for additional data files the package
makes available for loading using @code{data()}.  Currently, data files
can have one of three types as indicated by their extension: plain R
code (@file{.R} or @file{.r}), tables (@file{.tab}, @file{.txt}, or
@file{.csv}), or @code{save()} images (@file{.RData} or @file{.rda}).

Now in my book, .csv files contain comma separated values, .tab files
contain values separated by TABs and .txt files are "pure" text files,
presumably values separated by any kind of white space. 

Thus, I think that the expectation that TAB-delimited file formats
should work is not unreasonable; I was long time ago bitten by this
too. Then I realised that the phrase "one of the three types" should
probably be interpreted as implying that .tab, .txt and .csv files are
all of the same type and, apparently, should contain values separated
by whitespace.  I admit that I never tested whether .csv files would
lead to the same problems as TAB delimited .tab files. Rather, I decided
in the end that the safest option, i.e. to avoid misleading file
extensions, would be to use .rda files in the future.



=========================== Full address =============================
Berwin A Turlach                            Tel.: +65 6515 4416 (secr)
Dept of Statistics and Applied Probability        +65 6515 6650 (self)
Faculty of Science                          FAX : +65 6872 3919       
National University of Singapore     
6 Science Drive 2, Blk S16, Level 7          e-mail: statba at nus.edu.sg
Singapore 117546                    http://www.stat.nus.edu.sg/~statba

More information about the R-help mailing list