From the course: Complete Guide to R: Wrangling, Visualizing, and Modeling Data

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Converting data from tables to rows

Converting data from tables to rows

- [Instructor] Sometimes it's nice to be concise. It's nice to set up your data in compact formats. In R that often takes the form of tables that list categorical variables in combinations. And then you put, for instance, the number of cases or observations that fall into each combination. This is a very small, efficient way of storing your data and often presenting it, but it can also create some real problems for analysis. And so you may need to take your data out of a table format and put it into a long row by row format. And I want to show you how to do that. But I'm going to have to start with a little mea culpa by showing you how I used to demonstrate this, which I consider the wrong way. Now we're going to come down here and load a few packages, and then I'm going to show you a data set called UCB Admissions. That stands for University of California at Berkeley. And this is a very well known data set because it looks at the differences in associations that can happen at…

Contents