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
- Load the
mtcars dataset.
- Display the first few rows.
- Check the structure and summary of the dataset.
# Your code here
Step 2: Rename Columns
- Rename the columns to be more descriptive (e.g.,
mpg to
Miles_per_Gallon, etc.).
- Display the new column names.
# Your code here
Step 3: Check Data Quality
- Check for missing values.
- Check for duplicate rows.
# Your code here
Step 4: Create New Variables
- Convert weight (
Weight) from 1000 lbs to kg.
- Create a new column called
High_Horsepower that is
“Yes” if horsepower > 150.
# Your code here
Step 5: Visualization
- Create a scatter plot showing the relationship between weight (kg)
and miles per gallon.
# Your code here
Challenge (Bonus)
- Create a new variable that classifies cars as “Light” or “Heavy”
based on
Weight_kg.
- Change the
High_Horsepower threshold to 120 and observe
the impact.
# Your code here