New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
group_by and summarise don't work after another analysis. "Can't subset elements that don't exist." #5733
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I have run into this as well. I suspect it has to do with not being able to pass-in additional arguments. Have temporarily switched to a formula specification in library(dplyr)
# works in 1.0.3 and 1.0.4
storms %>%
mutate(across(name, ~forcats::fct_reorder(., .x = hour)))
#> # A tibble: 10,010 x 13
#> name year month day hour lat long status category wind pressure
#> <fct> <dbl> <dbl> <int> <dbl> <dbl> <dbl> <chr> <ord> <int> <int>
#> 1 Amy 1975 6 27 0 27.5 -79 tropi… -1 25 1013
#> 2 Amy 1975 6 27 6 28.5 -79 tropi… -1 25 1013
#> 3 Amy 1975 6 27 12 29.5 -79 tropi… -1 25 1013
#> 4 Amy 1975 6 27 18 30.5 -79 tropi… -1 25 1013
#> 5 Amy 1975 6 28 0 31.5 -78.8 tropi… -1 25 1012
#> 6 Amy 1975 6 28 6 32.4 -78.7 tropi… -1 25 1012
#> 7 Amy 1975 6 28 12 33.3 -78 tropi… -1 25 1011
#> 8 Amy 1975 6 28 18 34 -77 tropi… -1 30 1006
#> 9 Amy 1975 6 29 0 34.4 -75.8 tropi… 0 35 1004
#> 10 Amy 1975 6 29 6 34 -74.8 tropi… 0 40 1002
#> # … with 10,000 more rows, and 2 more variables: ts_diameter <dbl>,
#> # hu_diameter <dbl>
# works in 1.0.3, fails in 1.0.4
storms %>%
mutate(across(name, forcats::fct_reorder, .x = hour))
#> Error: Problem with `mutate()` input `..1`.
#> x object 'hour' not found
#> ℹ Input `..1` is `(function (.cols = everything(), .fns = NULL, ..., .names = NULL) ...`.Created on 2021-02-05 by the reprex package (v1.0.0) |
romainfrancois
added a commit
that referenced
this issue
Feb 15, 2021
…ause it is internally referenced and weird stuff happens. closes #5733
romainfrancois
added a commit
that referenced
this issue
Feb 15, 2021
* no longer need expr_protect() * Only modify the content of .current_group, not the object itself, because it is internally referenced and weird stuff happens. closes #5733 * news
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When doing analysis using group_by and summarise, an isolated analysis works but when an unrelated analysis proceeds it, there is an error. This does not occur with dplyr 1.0.2. Issue originally posted on community.rstudio.com by someone else: https://community.rstudio.com/t/it-works-alone-but-fails-successively/95017
Working example:
Created on 2021-02-03 by the reprex package (v1.0.0)
Session info
Broken example:
Created on 2021-02-03 by the reprex package (v1.0.0)
Session info
The text was updated successfully, but these errors were encountered: