Add performance's plots to a plot in R marckdown

Hello
(This is my first topic, maybe it's not well done)
image trop stylée
I did machine learning models and then I plotted the ROC curves of the models. (random forest, LDA, and regression with penalty)

I need to plot all the results in 1 plot

It worked fine af but I have to present it with f****** markdown and the same code doesn't work now

My chunk:


plot(forestperf, main='ROC', col = 3 , lwd = 2)
plot(perf,col = 2, lwd= 2 ,add=TRUE)
plot(perfR, col=5 , lwd=2 , add=T)
plot(perfL, col='#996600' , lwd=2, add=T)
plot(perfE, col=9 , lwd=2, add = T)

legend(0.6, 0.6, c('random forest', 'LDA' , 'ridge' , 
                   'lasso', 'elastic net'), col=c(3,2,5,'#996600',9), lty=c(1,1,1,1,1) )

When I do it within a chunk it says that performances cannot be plotted.

Is anyone able to help me? ^^ :ok_man:

while I appreciate you are probably doing it out of humour/levity, I have taken the liberty of removing the 'threat' that was previously in your post, and ask you to refrain from such on this forum.

Here is not a chunk but rather a complete rmarkdown that you can try to see.
If you want specific help, then it is recommended that you provide a reprex
FAQ: How to do a minimal reproducible example ( reprex ) for beginners

---
title: "R Notebook"
output:
  html_document:
    df_print: paged
---


```{r}
library(ROCR)
data(ROCR.hiv)

pp <- ROCR.hiv$hiv.svm$predictions[[1]]

ll <- ROCR.hiv$hiv.svm$labels[[1]]

pred<- prediction(pp, ll)

perf <- performance(pred, "tpr", "fpr")

plot(perf, avg= "threshold", colorize=TRUE, lwd= 3,
           main= "With ROCR you can produce standard plots like ROC curves ...")
```

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.