[Rd] surprising behaviour of names<-

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Thu Mar 12 10:21:18 CET 2009


Wacek Kusnierczyk wrote:
>
> is precisely why i'd think that the prefix 'names<-' should never do
> destructive modifications, because that's what x = 'names<-'(x, 'foo'),
> and thus also names(x) = 'foo', is for.
>
>   

to make the point differently, i'd expect the following two to be
equivalent:

    x = c(1); 'names<-'(x, 'foo'); names(x)
    # "foo"

    x = c(1); do.call('names<-', list(x, 'foo')); names(x)
    # NULL

but they're obviously not.  and of course, just that i'd expect it is
not a strong argument.

vQ



More information about the R-devel mailing list