Skip to content

Instantly share code, notes, and snippets.

@ayoskovich
Created November 2, 2021 17:01
Show Gist options
  • Save ayoskovich/b68293e1ce31b76f7ff5a760e65f43f6 to your computer and use it in GitHub Desktop.
Save ayoskovich/b68293e1ce31b76f7ff5a760e65f43f6 to your computer and use it in GitHub Desktop.
Create dataframe of value counts of all variables in select statement.
df %>%
select(
colA,
colB,
colC
) %>%
mutate_all(~as.character(.x)) %>%
map_df(
~count(data.frame(x=.x), x),
.id="var"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment