Last active
February 27, 2021 19:44
-
-
Save madilk/6ab60fb7694526fca4a7ba19d352c193 to your computer and use it in GitHub Desktop.
GGplot R - Make geom_historgram bin start at zero
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
##geom_histogram_v2 with center | |
ggplot(data=diamonds)+ | |
geom_histogram(mapping=aes(x = carat), | |
binwidth = 0.5,center=0.25) | |
##geom_histogram_v3 with boundary | |
ggplot(data=diamonds)+ | |
geom_histogram(mapping=aes(x = carat), | |
binwidth = 0.5,boundary=0) |
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
##geom_histogram | |
ggplot(data=diamonds)+ | |
geom_histogram(mapping=aes(x = carat), | |
binwidth = 0.5) |
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
#check summary of data | |
summary(diamonds) | |
##dplyr to get count of cut | |
diamonds %>% | |
count(cut_width(carat,0.5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment