Blog Archives

Apply-style commands in R

March 14, 2013
By

Here's a quick table of what I think are the most useful apply-style commands in R: FunctionInputOutputBest forapplyRectangularRectangular or vectorApplying function to rows or columnslapplyAnythingListNon-trivial operations on almost any data typesap...

Read more »

R scripts for analyzing survey data

February 2, 2013
By

Another site pops up with open code for analyzing public survey data: http://www.asdfree.com/ It will be interesting to see whether this gets used by the general public--given the growing trend of data journalism and so forth--versus academics. It is...

Read more »

This is *huge*: SAScii package

July 10, 2012
By

http://blog.revolutionanalytics.com/2012/07/importing-public-data-with-sas-instructions-into-r.html Q: How do you make a hairless primate? Answer 1: Take a hairy primate, wait a few million years and see if Darwin was right. Answer 2: Make them work i...

Read more »

Dates and times in R

March 16, 2012
By

Nothing looks funnier than a patchy simian. That's why we sighed a great sigh of relief when we spotted this article on the lubridate package in R. It saves a great deal of hair pulling.http://www.r-statistics.com/2012/03/do-more-with-dates-and-times...

Read more »

Reading huge files into R

February 19, 2012
By

SAS is much touted for its ability to read in huge datasets, and rightly so. However, that ability comes at a cost: for smaller datasets, since files remain on the disk rather than in memory (as is the case with Stata and R), it is potentially less fa...

Read more »

We are now a part of R-bloggers.com

June 9, 2011
By

R-bloggers is a site that aggregates many of the best R blogs on the internet. We're glad they've allowed our R-related posts to be aggregated there. If you mainly write in R, it's worth checking them out.

Read more »

R: Speeding things up

June 9, 2011
By

R is many things, but it's not exactly speedy like a Patas Monkey. In fact, while it is much faster than many other solutions, R is notably slower than Stata (even inspiring talks that it should be rewritten from scratch!).Fortunately, Radford Neal ha...

Read more »

R: Drop factor levels in a dataset

March 9, 2011
By

R has factors, which are very cool (and somewhat analogous to labeled levels in Stata). Unfortunately, the factor list sticks around even if you remove some data such that no examples of a particular level still exist# Create some fake datax levels(x)x levels(x) # still the same levelstable(x) # even though one level has 0 entries!The solution is...

Read more »

R: Functions and environments and a debugging utility, oh my!

February 7, 2011
By

The Mark Fredrickson blog has a superb post on R functions and environments that's well worth checking out.He also includes a handy function for debugging:> fnpeek + env + if (is.null(name)) {+ return(ls(envir = env))+ }+ ...

Read more »

R: Colors

February 4, 2011
By

"It ain't easy being green. ~ Kermit T. F. Matt Blackwell at the SSSB has made it easy to access all the Craylola(tm) colors in R.And in case you're not familiar with the way R handles color, here are a few resources:* The best color chart for R.* Colo...

Read more »