-
Notifications
You must be signed in to change notification settings - Fork 71
Closed
Description
Not sure if this is a bug in dplyr or vctrs or my code. Here's a reprex:
library(vctrs)
library(tidyverse)
new_YYYY <- function(x) {
new_rcrd(
list(year = x),
class = "YYYY")
}
test_data <-
tibble::tibble(
year = new_YYYY(c(2011, 2011, 2012, 2012)),
foo = 1:4,
bar = c("A", "A", "B", "B"))
# Grouping by `year` alone works ...
grouped_by_year <- group_by(test_data, year)
# ... and grouping by `foo` and `bar works (neither are vctrs) ...
grouped_by_foo_and_bar <- group_by(test_data, foo, bar)
# ... but grouping by a combination of `year` (vctrs) and `foo` (numeric) throws an error.
grouped_by_year_and_foo <- group_by(test_data, year, foo)
#> Error: Internal error in `p_equal_na_equal()`: Unsupported vctrs type `dataframe`.
Here's the output of rlang::last_error():
<error/rlang_error>
Internal error in `p_equal_na_equal()`: Unsupported vctrs type `dataframe`.
Backtrace:
1. dplyr::group_by(test_data, year, foo)
2. dplyr:::group_by.data.frame(test_data, year, foo)
3. dplyr::grouped_df(groups$data, groups$group_names, .drop)
4. dplyr:::compute_groups(data, vars, drop = drop)
5. dplyr:::vec_split_id_order(group_vars)
6. vctrs::vec_group_loc(x)
Run `rlang::last_trace()` to see the full context.
... and the output of rlang::last_trace():
<error/rlang_error>
Internal error in `p_equal_na_equal()`: Unsupported vctrs type `dataframe`.
Backtrace:
█
1. ├─dplyr::group_by(test_data, year, foo)
2. └─dplyr:::group_by.data.frame(test_data, year, foo)
3. └─dplyr::grouped_df(groups$data, groups$group_names, .drop)
4. └─dplyr:::compute_groups(data, vars, drop = drop)
5. └─dplyr:::vec_split_id_order(group_vars)
6. └─vctrs::vec_group_loc(x)
7. └─(function () ...
Created on 2021-02-04 by the reprex package (v0.3.0)
Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 3.6.2 (2019-12-12)
#> os macOS Catalina 10.15.7
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/Los_Angeles
#> date 2021-02-04
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0)
#> backports 1.1.9 2020-08-24 [1] CRAN (R 3.6.2)
#> blob 1.2.1 2020-01-20 [1] CRAN (R 3.6.0)
#> broom 0.7.0 2020-07-09 [1] CRAN (R 3.6.2)
#> callr 3.5.1 2020-10-13 [1] CRAN (R 3.6.2)
#> cellranger 1.1.0 2016-07-27 [1] CRAN (R 3.6.0)
#> cli 2.3.0 2021-01-31 [1] CRAN (R 3.6.2)
#> colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.6.0)
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0)
#> DBI 1.1.0 2019-12-15 [1] CRAN (R 3.6.0)
#> dbplyr 1.4.4 2020-05-27 [1] CRAN (R 3.6.2)
#> desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.0)
#> devtools 2.3.1 2020-07-21 [1] CRAN (R 3.6.2)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 3.6.2)
#> dplyr * 1.0.4 2021-02-02 [1] CRAN (R 3.6.2)
#> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 3.6.2)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.0)
#> forcats * 0.5.0 2020-03-01 [1] CRAN (R 3.6.0)
#> fs 1.4.2 2020-06-30 [1] CRAN (R 3.6.2)
#> generics 0.0.2 2018-11-29 [1] CRAN (R 3.6.0)
#> ggplot2 * 3.3.2 2020-06-19 [1] CRAN (R 3.6.2)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 3.6.2)
#> gtable 0.3.0 2019-03-25 [1] CRAN (R 3.6.0)
#> haven 2.3.1 2020-06-01 [1] CRAN (R 3.6.2)
#> highr 0.8 2019-03-20 [1] CRAN (R 3.6.0)
#> hms 0.5.3 2020-01-08 [1] CRAN (R 3.6.0)
#> htmltools 0.5.0 2020-06-16 [1] CRAN (R 3.6.2)
#> httr 1.4.2 2020-07-20 [1] CRAN (R 3.6.2)
#> jsonlite 1.7.1 2020-09-07 [1] CRAN (R 3.6.2)
#> knitr 1.30 2020-09-22 [1] CRAN (R 3.6.2)
#> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 3.6.0)
#> lubridate 1.7.9 2020-06-08 [1] CRAN (R 3.6.2)
#> magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.0)
#> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.0)
#> modelr 0.1.8 2020-05-19 [1] CRAN (R 3.6.2)
#> munsell 0.5.0 2018-06-12 [1] CRAN (R 3.6.0)
#> pillar 1.4.6 2020-07-10 [1] CRAN (R 3.6.2)
#> pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 3.6.2)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.0)
#> pkgload 1.1.0 2020-05-29 [1] CRAN (R 3.6.2)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.1)
#> processx 3.4.5 2020-11-30 [1] CRAN (R 3.6.2)
#> ps 1.3.4 2020-08-11 [1] CRAN (R 3.6.2)
#> purrr * 0.3.4 2020-04-17 [1] CRAN (R 3.6.1)
#> R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.1)
#> Rcpp 1.0.5 2020-07-06 [1] CRAN (R 3.6.2)
#> readr * 1.3.1 2018-12-21 [1] CRAN (R 3.6.0)
#> readxl 1.3.1 2019-03-13 [1] CRAN (R 3.6.0)
#> remotes 2.2.0 2020-07-21 [1] CRAN (R 3.6.2)
#> reprex 0.3.0 2019-05-16 [1] CRAN (R 3.6.0)
#> rlang 0.4.10 2020-12-30 [1] CRAN (R 3.6.2)
#> rmarkdown 2.4.6 2020-10-20 [1] Github (rstudio/rmarkdown@7239cea)
#> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.0)
#> rvest 0.3.6 2020-07-25 [1] CRAN (R 3.6.2)
#> scales 1.1.1 2020-05-11 [1] CRAN (R 3.6.2)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0)
#> stringi 1.5.3 2020-09-09 [1] CRAN (R 3.6.2)
#> stringr * 1.4.0 2019-02-10 [1] CRAN (R 3.6.0)
#> testthat 3.0.1 2020-12-17 [1] CRAN (R 3.6.2)
#> tibble * 3.0.3 2020-07-10 [1] CRAN (R 3.6.2)
#> tidyr * 1.1.1 2020-07-31 [1] CRAN (R 3.6.2)
#> tidyselect 1.1.0 2020-05-11 [1] CRAN (R 3.6.2)
#> tidyverse * 1.3.0 2019-11-21 [1] CRAN (R 3.6.0)
#> usethis 1.6.1 2020-04-29 [1] CRAN (R 3.6.2)
#> vctrs * 0.3.6 2020-12-17 [1] CRAN (R 3.6.2)
#> withr 2.4.1 2021-01-26 [1] CRAN (R 3.6.2)
#> xfun 0.18 2020-09-29 [1] CRAN (R 3.6.2)
#> xml2 1.3.2 2020-04-23 [1] CRAN (R 3.6.2)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 3.6.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library
Thank you in advance for your time and attention!
Metadata
Metadata
Assignees
Labels
No labels