RE: [R] R annoyances

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Fri 20 May 2005 - 23:39:24 EST

On Fri, 20 May 2005, bogdan romocea wrote:

> On 20-May-05 Uwe Ligges wrote:
>> All possible changes to T/F (both removing the meaning of
>> TRUE/FALSE in a clean session and making them reserved words)
>> would break code of lots of users.
>
> Just wanted to point out that there's another (darker) side to this:
> code that produces bad results without the users even realizing it.
> Personally, I would clearly prefer lots of broken code to mistakes
> caused by T/TRUE and F/FALSE.

You do realize that R CMD check checks for use of unassigned T/F? So it would only be unchecked code which did that.

> Hypothetically, if whatever=T/F were forbidden and only
> whatever=TRUE/FALSE were allowed, all the code could be fixed with a
> simple sed script:
> for F in `ls *.r`
> do
> mv $F $F.$$
> sed -e 's/=T,/=TRUE,/g' -e 's/=F,/=FALSE,/g' -e 's/=T)/=TRUE)/g' -e
> 's/=F)/=FALSE)/g' $F.$$ > $F
> rm $F.$$
> done

I assure you it is a *lot* harder than that. Some of us use spaces for a start. No sed script can know the difference between

F <- "2"; as.numeric(x = F)
F <- "2"; as.numeric(x = FALSE)

(I know because I used to share code bases for S-PLUS and R, and had Perl scripts to do the conversion that worked for my style, but not for some other authors' code.)

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri May 20 23:58:58 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:57 EST