I created a plot that ranges in date from 01-01-2012 to 12-31-2021. I've double checked the data to verify no dates before or after this interval, but my plot still shows the lines extending into 2011 and 2022. How can I fix my code to start and stop the line at exactly 2012 and 2021? Thanks!
plot1 <- lmic.clean7 %>% group_by(pubyear, Income) %>% dplyr::mutate(count = n()) %>% select(pubyear, Income, count)
plot1$pubyear <- as.Date(plot1$pubyear, format = "%Y")
g2 <- ggplot(plot1, aes(x = pubyear, y = count, colour = Income)) + geom_smooth()