R tip for the day
The ROCR package is very useful – and a bit tricky to install. The documentation says:
You will also need gplots from the R package bundle gregmisc
To avoid packages complaining that they can’t find other packages, install the packages in this order:
sudo R
install.packages("gtools","gdata","gplots","ROCR")
Update: you can also specify dependencies = T, repos = getOption(”repos_URL”) as options to install.packages()
Reading in data is easiest using read.table if you can hack an input file with column 1 = scores, column 2 = true/false, like this:
6.17 1
5.98 0
5.97 0
5.92 0
5.87 1
data <- read.table("myfile.dat")
pred <- prediction(data[,1], data[,2])
## ROC curve
plot(performance(pred, measure = "tpr", x.measure = "fpr"))



All hail R.
Often impenetrable error messages and a jumble of different coding styles, but the best tool for data analysis.
If you’re running R on OSX, there’s a button for “install dependencies”, I don’t know if will install things in the correct order though.
OSX – proprietary software – BOOOO!
Michael Barton
August 28, 2007 at 9:07 pm
I expect there’s a way to fix up dependencies in *nix too, but I don’t have a day to wade through the R “documentation” :)
It does rock for data analysis but jeez, it hurts sometimes.
nsaunders
August 28, 2007 at 9:54 pm
As per your update install.packages(…,dependencies=T) fixes it. I’d also suggest finding a convenient CRAN mirror and hardwiring its URL as repos=[URL], which eliminates the tiresome mirror menu.
R is, for better or worse, written in a very particular way. It makes a great deal of sense after a couple of years (or is that resignation?) but until then is infuriating. The thing that continuously surprises me is how useful it is – there are always interesting new stats and plots to look at data in ways I hadn’t even conceived of before.
chris
September 2, 2007 at 8:59 am