Skip to content

dplyr functions change variables for no reason since dplyr_0.8.0  #4221

@mariodejung

Description

@mariodejung

I couldn't thing about a better title, but I run into problems since the new dplyr release.

I narrowed it down to a single dplyr call, but it changes different variables in my script, even they are not "touched" by the dplyr call.

First of all, there is a group_by_at call, because 'if there is a column "species", I want to group by it'.
If the column does not exist, I get a warning, which was fine for me, but I don't understand the class changes for the other variables. This bringt problems downstream in my script because older functions can't handle the tibble yet.

library(dplyr)

set.seed(1)
# df <- data.frame(species=c('a','b'),
#                        Intensity=rnorm(1000, 25, 3))
df <- data.frame(Intensity=rnorm(1000, 25, 3))
class(df)
df_backup <- df

df_test <- 
  df %>% 
  dplyr::group_by_at(vars(matches('^species$'))) %>%
  dplyr::summarise(`5%`=stats::quantile(log10(Intensity),.05),
                   `50%`=stats::quantile(log10(Intensity),.50),
                   `95%`=stats::quantile(log10(Intensity),.95)) 
class(df)
class(df_test)
class(df_backup)

Metadata

Metadata

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