Skip to content

filter, slice, arrange dropping attributes #1064

@DavisBrian

Description

@DavisBrian

I'm not sure if this is by design or a bug.

I would expect that since filter and slice are subsets of the original data frame that all of the original data frames attributes would go along with it. Similarly since arrange is a reordering of the data I would expect it to keep attributes, much like group_by and select do.

library(dplyr)

dat <- as_data_frame(iris)
attr(dat, "meta") <- c("This is important")

# drops meta attributes
dat %>% filter(Species == "setosa") %>% attributes
dat %>% slice(1:50) %>% attributes
dat %>% arrange(Sepal.Width) %>% attributes


# keeps meta attribute
dat %>% group_by(Species) %>% attributes
dat %>% select(Petal.Length, Petal.Width, Species)  %>% attributes

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions