In case someone has the same headscratch as I did:
If you're doing a geom_line
plot with facet_wrap
and just one of the groups that your facetting with has an issue with the amount of data, you're going to get the message (ggplot 3.5.2)
`geom_line()`: Each group consists of only one observation.
ℹ Do you need to adjust the group aesthetic?
It took me a while to realize what was going on since I had a lot of groups and the plot looked mostly fine. The message concerns the panel which has only one observation. Simple example:
foo <- tibble(
value = c(1:4,1:4,1),
year = c(2001L:2004L, 2001L:2004L, 2002L),
g = c(rep("G1", 4), rep("G2", 4), "G3")
)
ggplot(foo, aes(year, value)) +
geom_line() +
facet_wrap(~g)