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
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Understanding the social security disability dataset2m 28s
-
(Locked)
Importing the social security disability dataset1m 22s
-
(Locked)
Making the social security disability dataset long1m 34s
-
(Locked)
Formatting dates in the social security disability dataset4m 6s
-
(Locked)
Fiscal years in the social security disability dataset2m 21s
-
(Locked)
Widening the social security disability dataset1m 46s
-
(Locked)
Visualizing the social security disability dataset1m 25s
-
(Locked)
-