Blog Archives

R graph with two y-axes

February 4, 2008
By
R graph with two y-axes

I’ve been asked how to do this several times, so I thought it might help to put an example online. x <- 1:5 y1 <- rnorm(5) y2 <- rnorm(5,20) par(mar=c(5,4,4,5)+.1) plot(x,y1,type="l",col="red") par(new=TRUE) plot(x, y2,,t...

Read more »

Organization and R

September 5, 2007
By

Many R users seem to get themselves in a bit of a mess with R files and workspaces scattered across different directories. The R files themselves also get messy and hard to follow. So here is some advice on keeping organized with R: Try to keep code ...

Read more »

Organization and R

September 5, 2007
By

Many R users seem to get themselves in a bit of a mess with R files and workspaces scattered across different directories. The R files themselves also get messy and hard to follow. So here is some advice on keeping organized with R: Try to keep code strictly indented based on the code structure

Read more »

Debugging in R

August 30, 2007
By

Anyone who starts writing serious R code (i.e., code that involves user-written functions) soon finds the need to use debugging tools. There are a few basic tools in R that are worth knowing about. The function debug() allows one to step through the ex...

Read more »

Debugging in R

August 30, 2007
By

Anyone who starts writing serious R code (i.e., code that involves user-written functions) soon finds the need to use debugging tools. There are a few basic tools in R that are worth knowing about. The function debug() allows one to step through the execution of a function, line by line. At any point, you can print

Read more »