Introduction

This R project will guide you through inspecting and cleaning the mtcars dataset. Please answer all questions and complete the code blocks.


Step 1: Load and Inspect the Dataset

  1. Load the mtcars dataset.
  2. Display the first few rows.
  3. Check the structure and summary of the dataset.
# Your code here

Step 2: Rename Columns

  1. Rename the columns to be more descriptive (e.g., mpg to Miles_per_Gallon, etc.).
  2. Display the new column names.
# Your code here

Step 3: Check Data Quality

  1. Check for missing values.
  2. Check for duplicate rows.
# Your code here

Step 4: Create New Variables

  1. Convert weight (Weight) from 1000 lbs to kg.
  2. Create a new column called High_Horsepower that is “Yes” if horsepower > 150.
# Your code here

Step 5: Visualization

  1. Create a scatter plot showing the relationship between weight (kg) and miles per gallon.
# Your code here

Challenge (Bonus)

  1. Create a new variable that classifies cars as “Light” or “Heavy” based on Weight_kg.
  2. Change the High_Horsepower threshold to 120 and observe the impact.
# Your code here