[R] A slight trap in read.table/read.csv.
b.rowlingson at lancaster.ac.uk
Tue Mar 9 10:00:00 CET 2010
On Tue, Mar 9, 2010 at 8:11 AM, Patrick Connolly
<p_connolly at slingshot.co.nz> wrote:
> If you use ESS, you have the benefit of completions. Depending on
> what else could begin with T or F, you can press the TAB key after
> typing the first letter or two. Admittedly, three keystrokes isn't
> much shorter than TRUE -- but they are all with the left hand. You
> always get at least a 40% discount with FALSE. :-) -- except in the
> 'unlikely event' that you have objects named FALLOW or something
> else a lot like FALSE.
"FALSETTO"? Anyone analysing choral music in R?
I'd somehow got the impression that T and F were going to be removed
as values, but there's no mention of it in ?FALSE. The package check
utilities warn you if you use them.
Just looking at the source for the underlying cause of the read.csv
behaviour, which is type.convert in R which is do_typecvt in C, and it
/* This is a horrible hack
There's a couple of instances of:
if (strcmp(s, "F") == 0 || strcmp(s, "FALSE")
which are what do it. And are obviously not language-dependent - do
French people have 'VRAI' and 'FAUX' in their CSV files? Do they call
them DSV files:
Got to keep the Academie Francaise happy...
More information about the R-help