I'm plotting three lines with ggplot, but when it comes to selecting the aesthetics with logical indexing of the data frame, R outputs the error "incorrect number of dimensions".
JFK_weekday, LGA_weekday and EWR_weekday are three separate data frames built like this
JFK_weekday LGA_weekday EWR_weekday
NO x NO i NO m
YES y YES j YES n
This is the code I'm using to plot the lines
ggplot() +
geom_line(data=JFK_weekday,
aes(x=row.names.data.frame(JFK_weekday), y=JFK_weekday[, 1],
color="red", size=1.5)) +
geom_line(data=LGA_weekday,aes(x=row.names.data.frame(LGA_weekday),
y=LGA_weekday[, 1], color="blue", size=1.5)) +
geom_line(data=EWR_weekday, aes(x=row.names.data.frame(EWR_weekday),
y=EWR_weekday[, 1], color="yellow", size=1.5))
Ignoring the problems about the aesthetics having to be the same length (which I figured out I'm able to solve), my concern is that I get "incorrect number of dimensions" regarding the [ ,1] logical indexing, while this is working properly in the console. Any ideas?