From wdunlap at tibco.com  Wed Dec  9 02:54:28 2009
From: wdunlap at tibco.com (William Dunlap)
Date: Tue, 8 Dec 2009 17:54:28 -0800
Subject: [Rd] x[c()] <- value sets the mode to mode(value)
In-Reply-To: <59d7961d0912081744m115639eey980adc50d57ac0fb@mail.gmail.com>
References: <59d7961d0912081744m115639eey980adc50d57ac0fb@mail.gmail.com>
Message-ID: <77EB52C6DD32BA4D87471DCD70C8D700023AB391@NA-PA-VBE03.na.tibco.com>

> -----Original Message-----
> From: r-devel-bounces at r-project.org 
> [mailto:r-devel-bounces at r-project.org] On Behalf Of Henrik Bengtsson
> Sent: Tuesday, December 08, 2009 5:45 PM
> To: R-devel
> Subject: [Rd] x[c()] <- value sets the mode to mode(value)
> 
> Only for the record,
> 
> an unnecessary overhead when nothing is assigned:
> 
> > x <- integer(10)
> > str(x)
>  int [1:10] 0 0 0 0 0 0 0 0 0 0
> > x[c()] <- 1.0;
> > str(x)
>  num [1:10] 0 0 0 0 0 0 0 0 0 0
> 
> 'x' could equally well have renamed untouched.

I disagree.  I think the language is more predictable,
hence easier to use, if the class of the output of a
function depends only on the classes of the inputs,
not on the classes and lengths of the inputs.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  

> 
> /Henrik
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 



[Rd] x[c()] <- value sets the mode to mode(value)
William Dunlap