How to tally in R dplyr

Mar 13, 2021 15:44 ยท 117 words ยท 1 minute read

I decided to explore some common functions from tidyverse ecosystem in an attempt to start participating in the #tidytuesday.

tally verb is another used functions I noticed in the participants scripts.

Let’s deep dive on some options:

# simple wrapper to summarize number of observations from a dataframe, similar to nrow()
df %>% tally()

# basic ordered , could be replaced with previous blog post - **count()**
df %>% group_by(grup) %>% tally(column, sort = TRUE)

# using all function options
df %>% tally(column1, wt=w, sort = TRUE, name="Total")


If you find my notes to be incomplete, help me via github or write me ๐Ÿ’Œ๐Ÿ˜Š. You can send me a message if you liked my post too! ๐Ÿ˜‰