Hadley Wickham
2016-Mar-01 15:12 UTC
[Rd] Data frame printing buglet when multiple empty column names
This is admittedly minor, and you shouldn't have repeated names in a data frame anyway, but: df <- data.frame(1:3, 1:3, 1:3) # Ok setNames(df, c("x", "y", "")) # Not ok setNames(df, c("x", "", "")) Hadley -- http://hadley.nz
Martin Maechler
2016-Mar-01 18:48 UTC
[Rd] Data frame printing buglet when multiple empty column names
>>>>> Hadley Wickham <h.wickham at gmail.com> >>>>> on Tue, 1 Mar 2016 09:12:00 -0600 writes:> This is admittedly minor, and you shouldn't have repeated names in a > data frame anyway, but: > df <- data.frame(1:3, 1:3, 1:3) > # Ok > setNames(df, c("x", "y", "")) > # Not ok > setNames(df, c("x", "", "")) > Hadley > -- > http://hadley.nz This has been fixed in R-devel several months ago, but not been ported to R-patched, the change really being in format.data.frame(.) which in R-devel makes use of a quite smartly improved as.data.frame.list() method. At the time, I was reluctant to port all these changes to R-patched, as they were non trivial... but indeed I did like the result (code, not just this case) quite a bit better. This is the log entry ------------------------------------------------------------------------ r69582 | maechler | 2015-10-29 17:12:54 +0100 (Thu, 29 Oct 2015) | 2 lines PR#16580: data frames with column name "StringsAsFactors" now format and print correctly; data.frame() gains argument `fix.empty.names` and as.data.frame.list() gets new `cut.names`, `col.names` and `fix.empty.names`. ------------------------------------------------------------------------ I'm still a bit reluctant to port this to R-patched... but may could be motivated ... Martin
Hadley Wickham
2016-Mar-01 22:48 UTC
[Rd] Data frame printing buglet when multiple empty column names
On Tue, Mar 1, 2016 at 12:48 PM, Martin Maechler <maechler at stat.math.ethz.ch> wrote:>>>>>> Hadley Wickham <h.wickham at gmail.com> >>>>>> on Tue, 1 Mar 2016 09:12:00 -0600 writes: > > > This is admittedly minor, and you shouldn't have repeated names in a > > data frame anyway, but: > > > df <- data.frame(1:3, 1:3, 1:3) > > > # Ok > > setNames(df, c("x", "y", "")) > > > # Not ok > > setNames(df, c("x", "", "")) > > > Hadley > > -- > > http://hadley.nz > > This has been fixed in R-devel several months ago, but not been > ported to R-patched, the change really being in > format.data.frame(.) which in R-devel makes use of a quite > smartly improved as.data.frame.list() method.Thanks Martin!> At the time, I was reluctant to port all these changes to > R-patched, as they were non trivial... but indeed I did like the > result (code, not just this case) quite a bit better. > > This is the log entry > ------------------------------------------------------------------------ > r69582 | maechler | 2015-10-29 17:12:54 +0100 (Thu, 29 Oct 2015) | 2 lines > > PR#16580: data frames with column name "StringsAsFactors" now format and print correctly; > data.frame() gains argument `fix.empty.names` and as.data.frame.list() gets new `cut.names`, `col.names` and `fix.empty.names`. > ------------------------------------------------------------------------ > > > I'm still a bit reluctant to port this to R-patched... but may > could be motivated ...It's not high priority for me - I'm happy knowing that it'll be fixed in R 3.3.0 Hadley -- http://hadley.nz
Seemingly Similar Threads
- Data frame printing buglet when multiple empty column names
- Control statements with condition with greater than one should give error (not just warning) [PATCH]
- ifelse() woes ... can we agree on a ifelse2() ?
- Advice on how to arrange fix of buglet
- ifelse() woes ... can we agree on a ifelse2() ?