You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
glimpse confuses factors with commas in levels #384
I suspect it's a rare case, but because glimpse doesn't quote factors like it does strings, if the factor level has a comma in it, it looks like they're two observations, e.g.
library(tibble)
glimpse(
tibble(x=factor(c('foo, bar', 'baz')),
y=factor(c('hello, world', 'howdy'), ordered=TRUE),
z= c('foo, bar', 'baz'))
)
#> Observations: 2#> Variables: 3#> $ x <fct> foo, bar, baz#> $ y <ord> hello, world, howdy#> $ z <chr> "foo, bar", "baz"
The evident solution would be to quote levels. Factors would be less differentiable from strings, though no worse than integers that happen to be stored as doubles, e.g. mtcars$gear.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
Activity
anhqle commentedon Feb 28, 2018
@krlmlr what's your take on quoting factor levels (i.e. with
"level")? Or perhaps quote using backticks?krlmlr commentedon Mar 1, 2018
I think we should use regular quotes here.
Add quotes around factor levels. Close tidyverse#384.
Add quotes around factor levels. Close tidyverse#384.
Merge pull request #389 from anhqle/384-add-quote-for-factor-in-glimpse
github-actions commentedon Dec 11, 2020
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.