Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program is R studio. Please help with following questions,Thank you! DATA CLEANING Changing data types for variables Display the structure of the data frame employee.

Program is R studio. Please help with following questions,Thank you!

DATA CLEANING

  • Changing data types for variables
  1. Display the structure of the data frame employee. What is the data type of the gender column?
  2. If data type is already factor, then skip the next two questions and go to question 14. If the type of the gender column is not factor, change the type of gender column to factor type.
  3. Display the structure of the data frame employee again. What is the data type of the gender column? Has it been changed to factor? If not, correct your code to change the type of gender column to factor type.
  4. Display the structure of the data frame employee once more to see the change.
  5. Display ALL data in employee object (data frame)
  • Replacing/Changing values:
  1. Change the hair color (hcolor) of Nancy to brown
  2. The birthday (birthyear) of 1993 is recorded for Chloe in row 5. Change 1993 to her age.
  3. The weights entered for the last three employees are in kilograms. Change these weights to lbs equivalents of: 144, 131, 199
  4. Display the employee data frame to see that the changes are recorded correctly.

DATA MANIPULATION

  • Adding and removing columns
  1. Remove hcolor column (column 7)
  2. Add the vectors country and citizen (created in question 1 and 3) as the new columns to employee data frame.
  3. Display the employee data
  • Missing Values (NA)

Checking for missing values (NA). Write the R codes for the following:

  1. Is there any missing value in employee object?
  2. How many missing values are there in the employee object?
  3. Is there any missing value in age variable (column)?
  4. How many missing values are there in age variable?
  5. Replace NA value in work column in row 4 (Michael's work) with 14.
  6. Calculate the mean age - ignore the NA values in the calculation.
  7. Replace the NA value in age in row 4 (Michael's age) with the mean age value (calculated in 27)
  8. Omit all other observations with missing values (NA). Note that this will remove all rows containing the missing data. Assign the revised data (without NA data) to a new data frame empComplete
  9. Display empComplete

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_2

Step: 3

blur-text-image_3

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

Business and Administrative Communication

Authors: Kitty o. locker, Donna s. kienzler

10th edition

77830105, 978-0077830106, 978-0073403182

More Books

Students also viewed these General Management questions

Question

Outline the four functions and two attitudes in Jungs psychology.

Answered: 1 week ago

Question

2. What are the steps in the new-product development process?

Answered: 1 week ago