Skip to content

Use/show new dplyr::across function #52

@lgatto

Description

@lgatto

Use cases search as, where interroA is in wide format

interroA %>% 
  privot_longer(names_to = "interro", values_to = "res", starts_with("interro")) %>%
  group_by(interro) %>%
  summarise(mean_interro = mean(res))

or

interroA %>%
   summarise(mean1 = mean(interro1), mean2 = mean(interro2), ...)

will be possible with

interroA %>%
   summarise(across(starts_with("interro"), mean))

See https://www.tidyverse.org/blog/2020/04/dplyr-1-0-0-colwise/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions