## R tips: Determine if function is called from specific package

June 16, 2009
By

I like the "multicore" library for a particular task. I can easily write a combination of if(require("multicore",...)) that means that my function will automatically use the parallel mclapply() instead of lapply() where it is available. Which is grand 99% of the time, except when my function is called from mclapply() (or one of the lower level functions)...

Read more »

## R tips: Determine if function is called from specific package

June 16, 2009
By

I like the "multicore" library for a particular task. I can easily write a combination of if(require("multicore",...)) that means that my function will automatically use the parallel mclapply() instead of lapply() where it is available. Which is grand 99% of the time, except when my function is called from mclapply() (or one of the lower level functions)...

Read more »

## Who wants school vouchers? Rich whites and poor nonwhites

June 15, 2009
By

As part of our Red State, Blue State research, we developed statistical tools for estimating public opinion among subsets of the population. Recently Yu-Sung Su, Yair Ghitza, and I applied these methods to see where school vouchers are more or...

Read more »

## Geography and Data

June 15, 2009
By

The Economist recently ran a fascinating article about the emergence of geographical databases and their uses for presenting and analyzing data.All this has made it much easier to create maps that explain—at a glance—something that might otherwise require pages of tables or verbiage. “A percentage or a table is still abstract for people,” says Dan Newman of MAPLight.org,...

Read more »

## Side by side analyses in Stata, SPSS, SAS, and R

June 15, 2009
By

I've linked to UCLA's stat computing resources once before on a previous post about choosing the right analysis for the questions your asking and the data types you have. Here's another section of the same website that has code to run an identical analysis in all of these statistical packages, with examples to walk through (as they note...

Read more »

## Replacing 0 with NA – an evergreen from the list

June 15, 2009
By

This thread from the R-help list describe an evergreen tip that, at least once, is proved useful in R practice.

Read more »

## Example 7.2: Simulate data from a logistic regression

June 13, 2009
By

It might be useful to be able to simulate data from a logistic regression (section 4.1.1). Our process is to generate the linear predictor, then apply the inverse link, and finally draw from a distribution with this parameter. This approach is useful in that it can easily be applied to other generalized linear models. In this...

Read more »

## Example 7.1: Create a Fibonacci sequence

June 12, 2009
By

The Fibonacci numbers have many mathematical relationships and have been discovered repeatedly in nature. They are constructed as the sum of the previous two values, initialized with the values 1 and 1.A pdf of this example is available here.SASIn SAS, we use the lag function (section 1.4.17,...

Read more »

## R tips: Installing Rmpi on Fedora Linux

June 12, 2009
By

Somebody on the R-help mailing list asked how to get Rmpi working on his Fedora Linux machine so he could do high-performance computing on a cluster of machines (or a single multicore machine) using the R statistical computing and analysis platform. Since it is unusually painful to get working, I might as well copy the instructions...

Read more »

## R tips: Installing Rmpi on Fedora Linux

June 12, 2009
By

Somebody on the R-help mailing list asked how to get Rmpi working on his Fedora Linux machine so he could do high-performance computing on a cluster of machines (or a single multicore machine) using the R statistical computing and analysis platform. Since it is unusually painful to get working, I might as well copy the instructions...

Read more »

## Simulation of Burning Fire in R

June 11, 2009
By

inlin Yan posted a cool (hot?) simulation of burning fire with R in the COS forum yesterday, which was indeed a warm welcome. I’m not sure whether our forum members will be scared by the “fire” under the title “Welcome to COS Forum”. The fire was mainly created by the function image() with

Read more »

## Creating Tag Cloud Using R and Flash / JavaScript (SWFObject)

June 10, 2009
By

ag cloud is a bunch of words drawn in a graph with their sizes proportional to their frequency; it’s widely used in blogs to visualize tags. We can observe important words quickly from a tag cloud, as they often appear in large fontsize. Tony N. Brown asked how to “graphically represent frequency of words in

Read more »

## Hack-at-it 2009

June 9, 2009
By

The annual GGobi hack-at-it was held June 5-7 in Ames Iowa. The main directions of work areDevelopment of a new canvas for R supporting interactive and dynamic graphics. Michael is leading the effort on this. Higher level routines for supporting brushi...

Read more »

## Hack-at-it 2009

June 9, 2009
By

The annual GGobi hack-at-it was held June 5-7 in Ames Iowa. The main directions of work areDevelopment of a new canvas for R supporting interactive and dynamic graphics. Michael is leading the effort on this. Higher level routines for supporting brushi...

Read more »

June 9, 2009
By

Read more »

## Two plot with a common legend – base graphics

June 6, 2009
By

If you need to share a common legend between two graphs using the ggplot2 package/paradigm take a look at this post from the Learning R blog.The code below solves the same task using the R base graphics.png( "2plot1legend.png", width = 480, height = 68...

Read more »

## Learning R for Researchers in Psychology

June 6, 2009
By

R is a powerful environment for statistical computing. Here is a selective list of resources on R with an emphasis on resources useful for researchers in psychology.Psychology specific R resourcesR Notes for Experimental PsychologyWilliam Revelle's Psy...

Read more »

## Introductory statistics with R

June 5, 2009
By

I know that a lot of you are scrambling to spend your training grant money by next week. If you think you'll ever need to use R, I strongly recommend buying this book: Introductory Statistics with R, by Peter Dalgaard (\$48, Amazon). I picked this up a while back and read through most of it in a...

Read more »

## Elementary Statistics with R

June 5, 2009
By

Ever wonder how to finish your statistics homework real fast? Or you just want a quick way to verify your tedious calculations in your statistics class assignment. We provide an answer here by solving statistics exercises with R. read more

Read more »

## Getting started with R (for german speakers)

June 5, 2009
By

Just a little note for german speaking R beginners: There is an introductory course in R (german) available online on the website of the department of methodology and evaluation research at the University of Jena. Dr. Ivailo Partchev holds a seven sess...

Read more »

## Twitter from R… Sure, why not!

June 4, 2009
By

So I have started following the #RStats tag in twitter. Prior to a week ago I had never Twitterbated so I thought I would give it a go since I am not one to shy away from new technology… much. I think of Twitter like a call in radio show where I get to cut

Read more »

## Use meaningful color schemes in your figures

June 3, 2009
By

Some of the best figure design ideas come from cartographers. If you've ever read a Tufte book you've seen lots of examples. Let's talk about using color effectively. Penn State geography professor Cindy Brewer's ColorBrewer tool for selecting color schemes for figures has been conveniently packaged into an R library called RColorBrewer. You'll have to read up...

Read more »

## How to plot a graph in R

June 2, 2009
By

Here's a quick tutorial on how to get a nice looking graph out of R (aka the R Project for Statistical Computing). Don't forget that help for any R command can be displayed by typing the question mark followed by the command. For example, to see help o...

Read more »

## Run a remote R session in emacs: emacs + ESS + R + ssh

June 1, 2009
By

I don’t know how, but somehow, i stumbled on how to do this. I’ve always used emacs with ESS to run R, since spring 2006 (did it on windows, switched to linux, for years, and most recently, on my macbook). I liked this because i get the same usual interface across ALL platforms (well, maybe

Read more »

## How to win the KDD Cup Challenge with R and gbm

June 1, 2009
By

Hugh Miller, the team leader of the winner of the KDD Cup 2009 Slow Challenge (which we wrote about recently) kindly provides more information about how to win this public challenge using the R statistical computing and analysis platform on a laptop (!).

Read more »

## How to win the KDD Cup Challenge with R and gbm

June 1, 2009
By

Hugh Miller, the team leader of the winner of the KDD Cup 2009 Slow Challenge (which we wrote about recently) kindly provides more information about how to win this public challenge using the R statistical computing and analysis platform on a laptop (!).

Read more »

## Ubuntu Developer Summit in Barcelona

May 31, 2009
By

Due to some things falling into place, I had an opportunity to attend the first two days of last week's Ubuntu Developer Summit in beautiful Barcelona. Somehow, I had never managed to attend a Debian conference either, so it was good to meet a few of t...

Read more »

## Ubuntu Developer Summit in Barcelona

Due to some things falling into place, I had an opportunity to attend the first two days of last week's Ubuntu Developer Summit in beautiful Barcelona. Somehow, I had never managed to attend a Debian conference either, so it was good to meet a few of the old Debian hands now moving Ubuntu along, as well as a few of the Ubuntu...

Read more »