Re: [Rd] x[c()] <- value sets the mode to mode(value)

From: William Dunlap <wdunlap_at_tibco.com>
Date: Tue, 08 Dec 2009 17:54:28 -0800

> -----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
>



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 09 Dec 2009 - 01:59:08 GMT

This archive was generated by hypermail 2.2.0 : Wed 09 Dec 2009 - 02:01:04 GMT