-
-
Save toyeiei/668465f3a47418715ead37ba9e730267 to your computer and use it in GitHub Desktop.
glimpse dplyr 2
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
# 4. create new columns | |
mtcars %>% mutate(hp_2 = hp * 2) | |
mtcars %>% mutate(log_hp = log(hp)) | |
# 5. summarise statistics | |
mtcars %>% | |
summarise(mean_hp = mean(hp), | |
sd_hp = sd(hp), | |
n = n()) | |
# 6. group_by() always used with summarise() | |
mtcars %>% | |
group_by(am) %>% | |
summarise(mean_hp = mean(hp)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment