I have used the following ggplot
command:
ggplot(survey, aes(x = age)) + stat_bin(aes(n = nrow(h3), y = ..count.. / n), binwidth = 10)
+ scale
I think all other solutions are really helpful to do this, but there is yet another way.
I assume:
dplyr
package, which has the convenient mutate
command, and your dataset is named survey
.
survey %>% mutate(Hosp1 = Hospital1, Hosp2 = Hospital2,........)
This command helps you to rename columns, yet all other columns are kept.
Then do the same facet_wrap
, you are fine now.