Tag Archives: data manipulation

Reshaping data in R revisited

A year ago, I wrote a post about reshaping data from a wide format to a long format. I thought that considering how much time had passed, it would be good to revisit R’s in-built reshape functions. For these examples, I’ve copied the Stata examples from the UCLA Academic Technology Services’s “Reshape data wide to [...]

Posted in Geekiness, Useless Knowledge | Also tagged , , , | Leave a comment

Regular expressions in R

In my last post (Sounds interesting. Is that a regular expression?), I showed a few things I had figured out recently related to regular expressions. By now, you have also figured out that I like figuring things out in R, and application of regular expressions is one of these things.

Posted in Geekiness, Useless Knowledge | Also tagged , | Leave a comment

Using the reshape package in R for pivot-table-like functionality

A little more than a week ago, I wrote about creating pivot tables in Microsoft Excel and OpenOffice.org. I also mentioned that I would explain how to do similar calculations by using R. This post will explain how to achieve similar results in R by using the reshape package. I had initially started experimenting with [...]

Posted in (all categories), Geekiness, Useless Knowledge | Also tagged , , , , , , , , , , | 8 Comments

Quickly reshaping data from “wide” to “long” formats in R

A lot of the times, students at the Academy enter data in a “wide” format (since it is a very natural way to enter data in a spreadsheet). Let’s say, for example, that they were collecting data for a household, and for each person, they were collecting information on three variables. Assume also that they [...]

Posted in (all categories), Geekiness, Useless Knowledge | Also tagged , , | 4 Comments