Issue with dplyr::count; Error in summarise_impl(.data, dots) : `.data` is a corrupt grouped_df

Ok I am posting this here only because I just encountered this while using the dev. version of dplyr.

Is anyone else encountering this?

I encountered the following issue when trying to use dplyr (version 0.7.5.9000).

Is anyone else encountering this?

library(dplyr)

#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

library(magrittr)
library(reprex)
data <- data_frame(
  id = c('a', 'a', 'b', 'b', 'c'),
  val = c(1, 2, 0, 1, 2)
)
data %>%
    dplyr::count(id)

#> Error in summarise_impl(.data, dots) : `.data` is a corrupt grouped_df

# I can always resort to this...
# (but at the expense of 'oh-so-many' keystrokes :())

data %$% base::table(id) %>% tibble::as_tibble()
#> # A tibble: 3 x 2
#>   id        n
#>   <chr> <int>
#> 1 a         2
#> 2 b         2
#> 3 c         1

# session information ----
packageVersion(pkg = "dplyr")
#> [1] '0.7.5.9000'
packageVersion(pkg = "magrittr")
#> [1] '1.5'
glimpse(as_tibble(R.Version()))
#> Observations: 1
#> Variables: 14
#> $ platform       <chr> "x86_64-apple-darwin15.6.0"
#> $ arch           <chr> "x86_64"
#> $ os             <chr> "darwin15.6.0"
#> $ system         <chr> "x86_64, darwin15.6.0"
#> $ status         <chr> ""
#> $ major          <chr> "3"
#> $ minor          <chr> "5.0"
#> $ year           <chr> "2018"
#> $ month          <chr> "04"
#> $ day            <chr> "23"
#> $ `svn rev`      <chr> "74626"
#> $ language       <chr> "R"
#> $ version.string <chr> "R version 3.5.0 (2018-04-23)"
#> $ nickname       <chr> "Joy in Playing"

There is currently one issue with this error in dplyr repo

I had this one today with dev dplyr, but it was a bit random. I assume there was something going on with dev version and its dependencies. So I used new 0.7.5 one from CRAN instead.

FWIW I can't reproduce after a fresh install of dev dplyr version. Is it fixed or just random ? :thinking:

devtools::dev_mode(on = TRUE)
#> Dev mode: ON
library(dplyr, warn.conflicts = FALSE)
packageVersion("dplyr")
#> [1] '0.7.5.9000'
data <- data_frame(
  id = c('a', 'a', 'b', 'b', 'c'),
  val = c(1, 2, 0, 1, 2)
)
data %>%
  dplyr::count(id)
#> # A tibble: 3 x 2
#>   id        n
#>   <chr> <int>
#> 1 a         2
#> 2 b         2
#> 3 c         1

Created on 2018-06-07 by the reprex package (v0.2.0).

1 Like

Ok I will re-download/install the dev version and see if that fixes it.

Thank you!