I am new to R and I am having trouble finding a method for determining optimum ROC threshold. I cannot figure out how to use cutpointr or to produce a table that will show sensivity/specifities for specific cutpoints. My code so far is below. The data set is 400 rows with 11 numeric variables. I would be grateful for any help. Thanks!

library(pROC)

library(caret)

set.seed(6)

train_sample<-sample(400,200)

BF<-as.data.frame(Analysis_16_1_21)

BF<-BF[-11]

BF$gender<-as.factor(BF$gender)

BF$fm<-as.factor(BF$fm)

BF_train<-BF[train_sample,]

BF_test<-BF[-train_sample,]

BF$fm<-as.factor(BF$fm)

m <- train(fm ~ ., data=BF_train, method = "glmboost")

p<-predict(m,BF_test,type="prob")

roc(BF_test$fm, p[,-1],plot=TRUE,legacy.axes=TRUE)