[Rd] Suggestion for comments in data files (i.e. read.table)

Telford Tendys telford@progsoc.uts.edu.au
Tue, 23 May 2000 17:47:06 +1000


> I am sure it is not `a very small change', I'm afraid.  Basically, input is
> not done in a line-oriented way. read.table uses scan and count.fields.  
> Both are internal functions that work at a char-by-char level.  You will
> need to add logic to skip lines, and for your rule that means adding logic
> to know that # is first in a line.

I just wanted to see if was a good idea in principle but thanks for
pointing out that read.table is not line oriented, I have not even started
to work through what would actually be required.

> My suggestion would be to allow # anywhere on the line to skip the
> rest of the line, and to make sure that # inside quotes did nothing.

Well it should be whatever is consistent with R source code unless there
is a good reason to make it otherwise, that minimises the learning required
for new users. Doing a quick test I see that allowing a comment to start
anywhere on the line is correct:

> x <- "# comment" # put the value "# comment" into x
> x
[1] "# comment"
> 

So I'm perfectly happy with that.

If the comment option defaulted to FALSE then it would be safe against
breaking existing code (I suppose everyone knew that already).

	- Tel
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._