I would like to perform a ROC curve analysis using the pROC package in R. I have a dataset (dataframe) of 45 subjects; each one of them has about 1000 values in a column called "spike_conn" that should predict my categorial variable "Resected" (another column in the dataframe).
I have created a large list of 45 dataframes using the split function like this:
list_data <- split(database_all, database_all$patient)
Then I have tried to use a for loop to perform the roc curve function for each element of the list (45 dataframes) like this:
Results_list <- list()
for (p in list_data) {
rocbj <- lapply(p, roc(list_data[[]][,29], list_data[[]][,5]))
Results_list[p] <- rocbj$auc
}
But it seems to be wrong, can somebody help? Thank you in advance