Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Gender earnings gap among younger workers Now, let's see what happens when we focus on workers in the early stages of their careers. First, we
Gender earnings gap among younger workers
Now, let's see what happens when we focus on workers in the early stages of their careers. First, we need to load the data. Because the March extract is contained in an xIsx file, we will use the readxlsx function provided by the package. Load the package and read the file, which is named mar.sowewillcheckyourcodehere.
R Code ~~ start over
there is no package called 'readx
Next, let's filter down to workers who are between years old. This will allow us to focus on individuals who in all likelihood have completed their educations but are still in the early stage of their careers. To do this we will need the filter function from the dplyr package. To parallel the analysis covered in the class slide deck, we will create a gender indicator using the mutate function from dplyr We could easily do both things in one chunk but we will split them up
The filtering action will take the original data set, cpsmar, filter on the age restriction, and create a new data set containing only the younger workers. The syntax goes like this:
newdataset olddataset
filterage
age
As an example, if we want filter out people younger than ie keep people who at least the filter command should look like this:
newdataset olddataset
filterage
Note that we have used or the "pipe", to pass the data to the filter function. The pipe is very useful because it allows you to code a sequence of operations that is easy to read and interpret.
Now, use this sample code to complete the filtering operation to create a new data set called containing only the younger workers.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started