Skip to content

names of list columns #2231

@romainfrancois

Description

@romainfrancois

There seems to be something wrong about list columns.

Here I'm creating a list column that contains named integer vector :

> d <- data_frame( x = rep(c(1,2), c(2,4)), y = 1:6, names = letters[1:6] )
> d
# A tibble: 6 × 3
      x     y names
  <dbl> <int> <chr>
1     1     1     a
2     1     2     b
3     2     3     c
4     2     4     d
5     2     5     e
6     2     6     f
> res <- d %>% group_by(x) %>% summarise( y = list( setNames(y, names) ) )
> res$y[[1]]
c d 
1 2 
> res$y[[2]]
c d e f 
3 4 5 6 
> names( res$y[[1]])
[1] "c" "d" "e" "f"
> names( res$y[[2]])
[1] "c" "d" "e" "f"

I'd expect names( res$y[[1]]) to be c("a", "b").

Metadata

Metadata

Assignees

Labels

bugan unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions