« Geostatistics and the 500-mile email problem | Main | Thursday: Tweet-chat on Multiple Sclerosis research »

May 07, 2012


Feed You can follow this conversation by subscribing to the comment feed for this post.

The only thing preventing me from converting full time to R is what others tell me is its lack of ability to process fixed width data sets, such as the CPS public use file. Is this true? I've heard there's a workaround using Python to pre-process data, but is there a within-R solution?

R handles fixed-format data just fine. You can import fixed-format data into R with the read.fwf function.

read.fwf will do it, but it is a bit tricky to use. I have an example of it reading one and two records per case at http://r4stats.com/books/free-version/ pages 14-16.

My books "R for SAS and SPSS Users" and "R for Stata Users" give a much more detailed explanation of read.fwf, but the free version should get you started.

For public archives that have SAS input statements, see the package SAScii which uses R to read data using actual SAS input statements. It's located at http://cran.r-project.org/web/packages/SAScii/index.html.

Terrific. I'll look into it. Thank you both.

ernie- here's the fully-commented code to read in the current population survey :)

The comments to this entry are closed.

Search Revolutions Blog

Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid
Get this blog via email with Blogtrottr