[R] Plotting questions (ROCR)

lehe timlee126 at yahoo.com
Fri May 8 15:28:15 CEST 2009


Thanks!
I am now also trying to plot several ROCs in the same figure using ROCR
package. The following code:

"pred1 <- prediction(yest1,ytest)
perf1 <- performance( pred1, "tpr", "fpr" )
plot( perf1 )
pred2 <- prediction(yest2,ytest)
perf2 <- performance( pred2, "tpr", "fpr" )
lines( perf2 )"

will result in error at "lines( perf2 )":

"Error in as.double(y) :   cannot coerce type 'S4' to vector of type
'double'"

Is there any way to solve it? 

Regards,




Richard Cotton wrote:
> 
>> 1. How to plot several lines in a figure? Suppose I have several sets of
>> points (xi,yi), where xi and yi are equal-length vector. plot(x1,y1) 
> will
>> give a line connecting these points. Another plot(x2,y2) will erase what
>> plot before and plot the new line. Can I have these lines all drawn in 
> the
>> same figure?
> 
> #Draw your plot
> plot(seq(0,1,length.out=20))
> 
> #Add lines to the existing plot
> lines(runif(20))
> 
> #Add points to the existing plot
> points(runif(20), col="red")
> 
>> 2. How to open another figure window? Repeating plot will redraw in the 
> same
>> window instead of opening another one.
> 
> On Windows, windows() will open a new figure window; quartz() on Mac OSX 
> and x11() on Linux do the same.
> 
> Regards,
> Richie.
> 
> Mathematical Sciences Unit
> HSL
> 
> 
> 
> ------------------------------------------------------------------------
> ATTENTION:
> 
> This message contains privileged and confidential inform...{{dropped:20}}
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> -----
> Regards,
> Richie.
> 
> Mathematical Sciences Unit
> HSL
> 

-- 
View this message in context: http://www.nabble.com/Plotting-questions-tp23442445p23446000.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list