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.
Yes, thanks about faceting. I just wanted to get the species all on one plot first. But I do have a follow up. I know I could make a data frame with only species Cc by filtering for it. However, is there a way to have the histogram showing only Cc and not the others by putting some specification for Cc in the ggplot or geom_histogram lines using the original data frame?
ggplot2 is not meant to be used for data wrangling so I don't think there is a way to filter the data using it and even if there is a way, it would be hacky since it is not an intended use and it would be impractical. Also, since tidyverse functions do not perform "in-place" modifications to the data, there is no harm in filtering the data before plotting, it is not going to affect your original data frame or store a new one if you do not explicitly assign the changes to a variable. You can filter on the fly by using the pipe operator (%>%), take a look at this example: