Created
August 15, 2019 07:46
-
-
Save toyeiei/aee30d998c9f7ed0db072fe5e6704d9b to your computer and use it in GitHub Desktop.
R4Excel - pivot table in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## count gender i.e. number of male and female students | |
df %>% | |
count(gender) | |
## count grouped gender and nationality | |
df %>% | |
count(gender, nationality) | |
## compute average age by gender group i.e. male age vs. female age | |
df %>% | |
group_by(gender) %>% | |
summarise(avg_age = mean(age)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment