From the course: Data Wrangling in R

Unlock the full course today

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

Making the social security disability dataset long

Making the social security disability dataset long

From the course: Data Wrangling in R

Making the social security disability dataset long

- [Instructor] So let's just take another look at this data set and with it. My biggest problem is the arrangement of the data. Primarily I have data for many different observations in the same row. So what I want to do is begin by lengthening this wide data set. I'd like to convert it. So I have a single data element in each row. And as we've done with other data sets, we can accomplish this by using the pivot longer function. Let's go ahead and give that a try. I'm going to create a new table called ssa_long, and I'm going to create it by starting with the pivot_longer function and giving it a few arguments. First, I need to tell it where to get the data and that's going to be from the SSA table. And then I need to tell it that I don't want to pivot the fiscal year column. I want to pivot all the other columns, the ones that are for different months, total or internet values, but that fiscal year I went to leave…

Contents