Question: Homework 2 : Due 9 / 1 3 / 2 4 , 1 1 : 5 9 pm Instructions: Place all work into a typed
Homework : Due :pm
Instructions:
Place all work into a typed onetotwo page document. Upload both the document
and the CleanNLS.csv dataset created in Problem e onto the Canvas homework page
by the due date. Documents must be in one of the following formats: doc, docx, or pdf
Data for completing these problems may be found under the "FilesHomeworkHomework
page on Canvas.
The file NLScsv contains data on a set of individuals. For each individual, the
following variables are measured: Urban whether or not the individual lives in an urban or
rural area Siblings number of siblings White if the individual is white, otherwise
Christian if the individual is Christian, otherwise FamilySize, Height in inches
Weight in pounds and Income.
Data Inspection:
apt How many observations are there in the dataset? How many variables are
there in the dataset?
bpt For each variable, how many missing entries are there? Also, give the
line or lines of code used to find this answer.
c Using the sort function, find the largest income for an individual in
the dataset. Find the smallest income for an individual in the dataset Also give
the line or lines of R code to find this answer.
Data Cleaning:
apt Remove all individuals from the dataset with income. Give the line or
lines of R code for this step.
bpt Afterward, replace all missing incomes with the median of the nonmissing
incomes. Give the line or lines of R code for this step.
cpt Apply the log transformation either base or base to the incomes and
add this as a column to the NLS data frame. Give the line or lines of R code
to perform these steps.
dpt Apply the square root transformation to weights and add this as a column
to the NLS data frame. Give the line or lines of R code to perform these steps.
e Change the fourth entry of the Urban variable to your name. Give the line
or lines of R code to perform these steps.
fpt After performing steps abcd and e export this cleaned
dataset as a csv file called CleanNLS.csv Give the line or lines of R code to
perform this step. Also, upload this file onto Canvas.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
