mickmcq
1
In the case where a list contains only an integer, I would like a tibble containing that list to display the integer. For example:
library{tidyverse}
tibble(x=1:3,y=list(3L,2L,1L))
displays
# A tibble: 3 × 2
x y
<int> <list>
1 1 <int [1]>
2 2 <int [1]>
3 3 <int [1]>
How can I get it to display the integers instead?
Try:
library(tidyverse)
tibble(x=1:3,y=list(3L,2L,1L)) %>%
unnest(cols = c(y))
# A tibble: 3 × 2
x y
<int> <int>
1 1 3
2 2 2
3 3 1
1 Like
system
Closed
3
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.