Answered step by step
Verified Expert Solution
Link Copied!

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 2009 extract is contained in an .xIsx file, we will use the read_xlsx function provided by the package. Load the package and read the file, which is named cps09mar.xlsx.(Youneedtogetthisrighttomoveon,sowewillcheckyourcodehere.)
R Code ~~ start over
there is no package called 'readx1'
Next, let's filter down to workers who are between 25-34 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, cps09mar, filter on the age restriction, and create a new data set containing only the younger workers. The syntax goes like this:
newdataset - olddataset %>%
filter(age =
age -..--)
As an example, if we want filter out people younger than 25(i.e., keep people who at least 25), the filter command should look like this:
newdataset - olddataset %>%
filter(age >=25)
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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago