I’m new to R, but learning all I can. I receive the message below when plotting a facetted density plot histogram.
Warning message: Removed ### rows containing missing values (geom_bar).
I’ve read the message may be due to an x-axis issue not showing all data points, however, after investigation it doesn’t appear so.
The error seems to be in the "position = "fill" " section of the geom_histogram. When the position = "fill" is removed no errors are produced.
Any help or advice is greatly appreciated.
library(ggplot2)
df <- data.frame(recividism = sample(0:2, 100, replace = T),
TotalDays = sample(15:1000, 100, replace = T),
NumEnroll = sample(1:7, 100, replace = T))
df$recividism <- as.factor(df$recividism)
levels(df$recividism) <- c("Not Perm", "Perm", "Rec")
ggplot(data = df, aes(x = TotalDays)) +
geom_histogram(aes(fill = recividism), position = "fill" ) +
facet_grid(facets = NumEnroll ~ .)