You have some problems in your syntax.
Note that you have converted gender to a factor
variable with values of “1” and “2” instead of “M” and “F”. If you run your code line-by-line, I’ll guess that it should work up to your last set of histograms.
Change those lines to:
hist(d$received[d$negotiated == TRUE & d$gender == 2],
main = 'Male Employees Who Negotiated Raises' )
hist(d$received[d$negotiated == TRUE & d$gender == 1],
main = 'Female Employees Who Negotiated Raises' )
Also, notice that I changed &&
to &
. Run d$negotiated == TRUE & d$gender == 2
and d$negotiated == TRUE && d$gender == 2
to see how they are different from each other.