r_squared <- function(y, y_hat){
y_bar <- mean(y)
SS_tot <- sum((y - y_bar)^2)
SS_res <- sum((y - y_hat)^2)
rsq <- 1 - (SS_res / SS_tot)
return(rsq)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.