I am trying to use a statement %+%to redo an existing chart with new data. My code is as follows:
df <- data.frame(ending=now()+hours(0:5), actual=runif(6), pred=runif(6))
p <- ggplot(df, aes(x=ending)) +
geom_line(aes(y=actual, color='Actual')) +
geom_line(aes(y=pred, color='Predicted')) +
ylab('Faults') +
scale_color_manual('Values', c("Predicted"="red", "Actual"="black"))
p
It works great. But when I try to replace a new one df, I find errors:
p1 %+% df
Error in bl1$get_call : $ operator is invalid for atomic vectors
Any thoughts?
source
share