stat_poly_eq error

I'm having trouble with this code:


##Call Packages##
options(stringsAsFactors = FALSE)


##Import Data##
NDVIAverages <-
header = TRUE)
Date <- NDVIAverages$Time <- format(NDVIAverages$Time)

#plot S1##
png(filename = "NDVIS1.png")
S1 <- ggplot(data = NDVIAverages, aes(x = Date, y = S1)) +
geom_point(color='blue') +
geom_smooth(method = lm, formula = y ~ x, color = 'red', se = FALSE) +
stat_poly_eq(formula = y ~ x,
aes(label = paste(..eq.label.., ..rr.label.., sep = "~~~")),
parse = TRUE)+
labs(x="Date", y="GPP", title="Average GPP for Treatment One")
print(S1) #print graph

When I run it I get this warning message:

Warning message: Computation failed in `stat_poly_eq()`: argument "x" is missing, with no default

I really don't know what is going on. It seems to me like x is defined in aes()

I do not understand the purpose of the code line I quoted above. The format() function returns a character representation of its input and that will not be appropriate for fitting.

Also, I think it would be better to make Date a column in NDVIAverages rather than a separate variable.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.