I have been trying to make a histogram of one variable incubation_days grouped by species. There are missing values, empty cells in the file. The resulting histogram has all the species together. I have recreated some data here from a big file, entering the NAs manually. I have tried making sure the species is a factor. What do I need to do? I get the same result if I use the actual file.
Thanks,
Jeff
library(tidyverse)
species <- c("Cc","Cc","Dc","Cc","Dc","Cc","Cc","Cc","Cc","Cc","Cc","Cm","Cm","Cm")
incubation_days <- c(NA,NA,79,63,60,NA,63,NA,58,NA,57,56,63,50)
turtle_activity_gtm1 <- data.frame(species, incubation_days)
turtle_activity_gtm1
ggplot(turtle_activity_gtm1, aes(x=incubation_days), fill=species) +
geom_histogram(stat="count", na.rm = TRUE, alpha = 0.5)