Hi, I'm new to R and am trying to fit a line of best fit to a data set that loosely follows that of an exponential decay function. I keep getting the error that x and y lengths differ and am not sure how to fix this. Any help would be appreciated. This is the code I am entering.
plot(Velocity$d[Time>15], jitter(Velocity$FluctuationVariable[Time>15], 2),
main = "FLUCTUATION VERSUS WATER DEPTH AFTER SURGE",
xlab = "Water Depth (Metres)", ylab = "Fluctuation Variable (Metres/Second)")
exponential.model = lm(Velocity$FluctuationVariable[Time>15] ~ log(Velocity$d[Time>15]))
summary(exponential.model)
lines(smooth.spline(Velocity$d,predict(exponential.model)), col="orange")