Publications by Stephen Turner

ggplot2: more wicked-cool plots in R

20.07.2009

As far as I know there are 3 different systems for producing figures in R: (1) base graphics, included with R, (2) the lattice package, and (3) ggplot2, one of the newer plotting systems which is, according to the creator Hadley Wickham, “based on the grammar of graphics, which tries to take the good parts of base and lattice graphi...

817 sym

ClipPath copies filename and path from windows for loading into R

04.09.2009

I wish I would have discovered this long ago.  Loading data into R or MySQL requires you to specify the full path to the file.  If you do this on a Windows machine there are two annoyances.  First, if you save something to your desktop the path to your desktop is really long.  Second, windows by default uses backslashes “\” in...

817 sym

Machine Learning in R

10.09.2009

Revolutions blog recently posted a link to R code by Joshua Reich with self-contained examples of using machine learning techniques in R, including various clustering methods (k-means, nearest neighbor, and kernel), recursive partitioning (CART), principle components analysis, linear discriminant analysis, and support vector machines....

816 sym

Find the function you’re looking for in R

14.09.2009

Any R user no matter what level of experience has had trouble finding the package or the function to do what you want to do and then figuring out how to use it.  The sos package in R just made that a lot easier. First, fire up R, then install the sos package (don’t omit the quotes): install.packages(“sos”) It’ll ask you to ...

816 sym

R clinic this week: Regression Modeling Strategies in R

16.09.2009

At this week’s R clinic Frank Harrell will unveil the new rms (Regression Modeling Strategies) package that is a replacement for the R Design package.  He will demonstrate the differences with Design, especially related to enhanced graphics for displaying effects in regression models.  Frank will also discuss the implementation of...

817 sym

Comparison of plots using Stata, R base, R lattice, and R ggplot2, Part I: Histograms

21.09.2009

One of the nicer things about many statistics packages is the extremely granular control you get over your graphical output.  But I lack the patience to set dozens of command line flags in R, and I’d rather not power the computer by pumping the mouse trying to set all the clicky-box options in Stata’s graphics editor.  I want so...

814 sym

R Commander: A Basic Statistics GUI for R

06.10.2009

R is a great tool with lots of resources for genetics, genome-wide association studies, and many other biological applications.  We’ve covered several places to find help in R in the past, but if you’re still apprehensive about diving into R’s command-line interface, fear not.  The R commander is a graphical user interface (GU...

817 sym

Visualizing sample relatedness in a GWAS using PLINK and R

09.10.2009

Strict quality control procedures are extremely important for any genome-wide association study.  One of the first steps you should take when running QC on your GWAS is to look for related samples in your dataset.  This does two things for you.  First, you can get an idea of how many related samples you have in your dataset, and se...

817 sym

Split, apply, and combine in R using PLYR

04.11.2009

While flirting around with previously mentioned ggplot2 I came across an incredibly useful set of functions in the plyr package, made by Hadley Wickham, the same guy behind ggplot2.  If you’ve ever used MySQL before, think of “GROUP BY”, but here you can arbitrarily apply any R function to splits of the data, or write one yourself. Imagin...

817 sym

QQ plots of p-values in R using ggplot2

09.11.2009

Way back will wrote on this topic.  See his previous post for Stata code for doing this.  Unfortunately the R package that was used to create QQ-plots here has been removed from CRAN, so I wrote my own using ggplot2 and some code I received from Daniel Shriner at NHGRI. Of course you can use R’s built-in qqplot() function, but I ...

810 sym