I have a dataframe with observed and modelled data, and I would like to calculate the R2 value. I expected there to be a function I could call for this, but can\'t locate o
Why not this:
rsq <- function(x, y) summary(lm(y~x))$r.squared rsq(obs, mod) #[1] 0.8560185