% plot() " /> % plot() " /> % plot() "/>

Non numeric argumento error in plot(), causing title to disappear

41 Views Asked by At

I'm trying to plot a ROC curve, with a numeric label for the optimal point and a title to the plot, however I keep getting

"Error in rocit %>% plot() + text(1 - opt$Specificity, opt$Sensitivity, : non-numeric argument to binary operator"

error message, causing my plot to miss it's title.

I feel like I'm missing something really simple and would appreciate any help, my code is as follows:

rocit %>% plot() + 
  text(1-opt$Specificity, opt$Sensitivity, paste('ponto de corte =', as.character(opt$Cutoff)),
                        pos = 3, offset = 1, font = 3)+
  title('Curva ROC para Eosinofilia Sérica X epos')

I've tried the code above, and checked class() for the two numeric arguments, they're numeric as expected. the plot comes out like this: enter image description here

if i remove the text argument, I get the same error and a plot with a title but no text: enter image description here

I have the following packages loaded:

library(tidyverse)
library(nortest)
library(Hmisc)
library(verification)
library(ROCR)
library(ROCit)

and the opt vector is:

 Cutoff     Depth  Accuracy Sensitivity Specificity   F-Score   younden
1    230 0.7005348 0.7860963   0.7898089   0.7666667 0.8611111 0.5564756
0

There are 0 best solutions below