[R] Inconsistency in 'names' when calling data.frame on other data.frames
Bert Gunter
bgunter@4567 @end|ng |rom gm@||@com
Fri Aug 21 18:37:35 CEST 2026
Don't know about "intended", but if the man pages do not satisfy, this
seems like the sort of infelicity that has already been reported and/or
that on which an internet query should yield info. As you are well aware
I'm sure, one can see what a developer who designed this behavior was
thinking; and also the possible negative consequences that the
inconsistency might entail.
Cheers,
Bert
On Fri, Aug 21, 2026 at 9:01 AM Peter Langfelder <peter.langfelder using gmail.com>
wrote:
> Hi all,
>
> when calling data.frame on other data frames and naming arguments, the
> way the 'names' of the result are formed seems to depend on whether
> the argument data frames have one or more columns. Specifically,
> consider this:
>
> > data.frame(a = data.frame(A = 1), b = data.frame(B = 1))
> A B
> 1 1 1
>
>
> Here the column names are simply copied from column names of the arguments.
> In contrast, if the argument data frames have two (or more) columns,
> here's what happens:
>
> > data.frame(a = data.frame(A = 1, C = 1), b = data.frame(B = 1, D = 1))
> a.A a.C b.B b.D
> 1 1 1 1 1
>
>
> The 'names' of the result are now <name of the argument>.<column name
> of the argument value>
>
> Is this behavior intended?
>
> Thanks,
>
> Peter
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list