library(caret) # datasets: original = c( -2, 1, -3, 2, 3, 5, 4, 6, 5, 6, 7) predicted = c(-1, -1, -2, 2, 3, 4, 4, 5, 5, 7, 7) # caret package functions RMSE(predicted, original) R2(predicted, original, form = "traditional") [1] 0.904534