I have a data frame with the two columns bloodlevel and sex (F & M only), with 14 male and 11 female.
bloodlevel sex
1 14.9 M
2 12.9 M
3 14.7 M
4 14.7 M
5 14.8 M
6 14.7 M
7 13.9 M
8 14.1 M
9 16.1 M
10 16.1 M
11 15.3 M
12 12.8 M
13 14.0 M
14 14.9 M
15 11.2 F
16 14.5 F
17 12.1 F
18 14.8 F
19 15.2 F
20 11.2 F
21 15.0 F
22 13.2 F
23 14.4 F
24 14.7 F
25 13.2 F
I am trying to create two histograms that differentiate females' and males' blood levels with facet_wrap.
I have tried
ggplot(Physiology, aes(x=sex, y=bloodlevel))+
geom_histogram(binwidth=5, fill="white", color="black")+
facet_wrap(~Physiology)+
xlab("sex")
but I’m getting the error
Error in `combine_vars()`:
! At least one layer must contain all faceting variables: `Physiology`.
* Plot is missing `Physiology`
* Layer 1 is missing `Physiology`
I am trying trying to facet the variable with plot like this: