Archive for April, 2010

Putting Labels Above Bars in Barplots in R

Let’s say you are creating a barplot in R. Sometimes you want to label the bars below the X axis. But sometimes you might also want to put a label above the bars. This is pretty easy to do but a little hidden. Below is a working example based on randomly generated data that illustrates [...] Read more »

Creating a Shortcut to Open Terminal in Specific Directory in Ubuntu

I finally made the leap to doing most of my research on computers that run on Linux. The distribution I’m using is Ubuntu. So far I’ve found it quite good. One thing I do frequently is open a Terminal (command) window in a specific directory. However, when you open the Terminal, it by default opens [...] Read more »

Solving “cannot find xml2-config” on Ubuntu 9.10

I was trying to install some packages in R recently that depended on the XML package. I used the nifty install.packages() command, but I was getting an error:
“cannot find xml2-config”
This error was preventing these other packages from being installed properly. It turns out that I needed to install a library called libxml2-dev. In my case, [...] Read more »

How to Create a Simple ROC Curve

I’m using the R statistical package and the ROCR package within that. Both of these are free and very flexible. Sometimes with that flexibility comes ambiguity as to what you should do to accomplish a relatively simple task. I am doing a data-mining (machine-learning) project in which I predict a cancer patient’s prognosis. The algorithms [...] Read more »

How to Access Slots in S4 Classes in R: Area Under Curve Example

In the R statistical package, you have various ways of representing and packaging data. The most simple is in a single variable. More complex representations include vectors, lists, matrices, and data frames. An even more complex representation is S4 Classes, which are intended to simulate object-oriented programming in R.
I was using an R package that [...] Read more »

How to Restart Figure and Page Numbering in LaTeX

When you’re creating a document with LaTeX, you sometimes want to restart the page numbering. In my case, it’s because I have an appendix (supplementary methods) section in a paper I’m writing. I want to be able to reference the figures in this section starting at 1 rather than starting at the number of the [...] Read more »