So I have data as such.
d <- structure(c(NA, 1L, 1L, 4L, NA, NA, NA, 1L, 4L, 1L), .Label = c("[1,8]",
"(8,29]", "(29,105]", "(105,738]"), class = "factor")
So I want to change all NA's to 0
and then plot.
library(ggplot2)
ggplot(data = data.frame(var = d)) +
geom_bar(aes(x = d), fill = "cornflowerblue")
However I try with the following and it doesn't work...
d <- ifelse(is.na(d) == FALSE, "0", d)