re: RPubs  Classification Metrics using R
The get.rocPlot.auc function gives an error. I have found similar error messages in this type of code.
Can you help? Thank you. Mary A. Marion
Here is a code extract. This is what the error message is referring to.
for (i in threshold.grid) {

yhat = as.numeric(df$prob>i)

predicted = cbind(df$predicted,yhat)
 }
 for (j in 1:length(threshold.grid)){

class.factor = factor(df$actual,levels = c(0,1))

predicted.factor = factor(predicted[,j], levels = c(0,1))

t = table(class.factor, predicted.factor)

sensitivity = t[2,2] / (t[2,2] + t[2,1])

specificity = t[1,1] / (t[1,1] + t[1,2])

y[j] = sensitivity

x[j] = 1  specificity
get.rocPlot.auc(report2)
Error in predicted[, j] : subscript out of bounds