set.seed(6)
testData <- data.frame(
                       x = c(rnorm(200), rnorm(200) + 1),
                       group = factor(rep(letters[1:2], each = 200)))
densityplot(~testData$x,
            groups = testData$group,
            auto.key = TRUE)   
rocValues <- roc(testData$x, testData$group)
aucRoc(rocValues)Run the code above in your browser using DataLab