"x" is a list, but does not contain the components "x" and "y",

I am trying to build a ROC curve for a multiclass task using the multiclass.roc function from the pROC package, but I get this error:

'x' is a list, but does not have components 'x' and 'y' 

What does this error mean, because an Internet search did not help me find the answer. I can print the roc object, but I cannot build it.

Thanks!

+11
source share
2 answers

If you call plot in the l : plot (l) list, the x coordinates will be taken from l$x and y coordinates from l$y . There are no x and y elements in your list.

Instead, you need to call plot (l$your.x.coordinate, l$your.y.coordinate) .

+11
source

Another (lazy) approach is to simply use the useful library

 install.packages('useful') library(useful) 

Example -

 wineUrl <- 'http://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data' wine <- read.table(wineUrl, header=F, sep=',') wine_kmeans <- wine[, which(names(wine) != "Cultivar")] wine_cluster <- kmeans(x=wine_kmeans , centers=3) plot(wine_cluster, data=wine_kmeans) 

enter image description here

0
source

All Articles