Full R Analysis
Everything together — a complete real analysis
🎓 Capstone Project
This is not a fill-in-the-blanks exercise. This is a real mini analysis project using everything you have learned across all 10 labs.
Scenario: You are a university research analyst examining student outcomes data. The registrar has given you a dataset of 100 students with GPA, study habits, demographics, and enrollment details. Your job is to answer six research questions and write an executive summary.
There are no pre-written answers here — write your own R code from scratch. A collapsed sample solution is provided at the bottom for reference after you try.
Step 1 — Generate the Dataset
Run this code first to create the students data frame. It will be available for all subsequent questions in the same session.
📋 Six Research Questions
Answer all six questions below using your own R code. Each question has its own editor.
- Population Description: How many students per major? What is the year distribution? What percentage are first-generation students? What percentage hold scholarships?
- GPA Distribution: What are the overall summary statistics for GPA? Break down mean GPA by major using
tapply(). Which major has the highest average GPA? - Study Hours & GPA Relationship: What is the Pearson correlation between study_hours_week and gpa? Fit a simple linear regression and interpret the slope.
- First-Generation Student Equity: Do first-generation students have significantly different GPAs from non-first-gen students? Run a t-test and state your conclusion.
- Multiple Regression: Predict GPA from study_hours_week + sleep_hours + first_gen + year. Which predictors are statistically significant?
- Executive Summary: Write an 8-sentence plain-English executive summary of your findings using
cat(). Address: sample size, average GPA, top major, study-GPA correlation, first-gen equity finding, and recommendations.
Population Description
GPA Distribution
Study Hours & GPA Relationship
First-Generation Student Equity
Multiple Regression
Write Your Executive Summary
Write an 8-sentence plain-English executive summary using cat(). Address: sample size, average GPA, top major, study-GPA correlation, first-gen equity finding, multiple regression result, and at least one recommendation.
cat(sprintf(...)) calls. This way your summary automatically updates if the data changes.📖 Sample Solution
Try all six questions yourself before opening this. There is no single “right” answer — good R code is readable, well-commented, and gets the correct result.
Click to reveal sample solution approach
🏆 You’ve Completed All 10 R Practice Labs!
You have built a complete R toolkit: vectors, data frames, dplyr, functions, strings, ggplot2, statistics, tidyr, reporting, and a full end-to-end capstone analysis. These skills cover the core of professional data science in R.
← Back to R Practice Labs Home Explore the Full Data Science Course → Try the AI for Educators Course →