Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

c_across() docs imply a dependency on rowwise() #7015

Open
charliejhadley opened this issue Apr 20, 2024 · 0 comments
Open

c_across() docs imply a dependency on rowwise() #7015

charliejhadley opened this issue Apr 20, 2024 · 0 comments

Comments

@charliejhadley
Copy link
Contributor

I find the docs for c_across() imply the requirement for a rowwise() call which isn't required.

Here's a reprex using {palmerpenguins} and another using base R's mtcars

library("tidyverse")
library("palmerpenguins")

penguins %>% 
  group_by(island) %>% 
  summarise(max_dimension = max(c_across(ends_with("mm")),
                                na.rm = TRUE))
#> # A tibble: 3 × 2
#>   island    max_dimension
#>   <fct>             <dbl>
#> 1 Biscoe              231
#> 2 Dream               212
#> 3 Torgersen           210

mtcars %>% 
  select(wt, drat, carb, gear) %>% 
  group_by(gear) %>% 
  summarise(max_value = max(c_across(where(is.numeric))))
#> # A tibble: 3 × 2
#>    gear max_value
#>   <dbl>     <dbl>
#> 1     3      5.42
#> 2     4      4.93
#> 3     5      8

I haven't got a good idea of what I think could be added to the docs so I'm logging the issue now and will try to come back later

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant