i'm new on R and i have a problem which i really tried to solve but i did not find any clue by myself.
I'm following instructions from "Machine Learning for Hackers" and the last step isn't working or have any google-answers :
What's working :
state.plot<-ggplot(all.sightings, aes(x=YearMonth,y=Sightings)) +
geom_line(aes(color="darkblue")) +
facet_wrap(~State,nrow=10,ncol=5,scales="free") +
theme_bw() +
scale_color_manual(values=c("darkblue"="darkblue"),guide=FALSE) +
scale_x_date(breaks = date_breaks("5 years"), labels = date_format("%Y")) +
xlab("Time") +
ylab("Number of Sightings") +
labs(title="Number of UFO sightings by Month-Year and U.S. State (1990-2010)")
My problem is there :
ggsave(plot = state.plot, filename ="C:\\Users\\l.b\\Downloads\\ufo_sightings.pdf", width = 14, height =8.5)
with the following error :
Error in layout_base(data, vars, drop = drop) : At least one layer
must contain all variables used for facetting
I'm using R
on Windows.