samuelbharti/r-for-beginners
Learn R programming with interactive lessons and slides using the Gapminder dataset-designed for workshops and self-paced learning.
R for Novices - Gapminder Lessons
An adapted version of Software Carpentry's R-novice-gapminder course, designed to provide a clearer, more focused learning experience for both instructors and students.
About This Course
This website presents R programming lessons in a decluttered, streamlined format that makes learning easier and more enjoyable. Whether you're an instructor teaching a workshop or a student learning independently, these lessons provide:
- Clear, focused content without unnecessary complexity
- Step-by-step examples using real-world data (Gapminder dataset)
- Hands-on exercises to practice your skills
- A clean, modern interface for easy navigation
Lessons
- Intro to R - Get oriented with R and RStudio (Page, Slides)
- Projects - Organize your work with projects (Page, Slides)
- Seeking Help - Learn to find and use help effectively (Page, Slides)
- Data Structures - Understand vectors, lists, and data frames (Page, Slides)
- Exploring Data Frames - Explore and inspect data frames in R (Page, Slides)
- Subsetting Data - Extract subsets of data with base R (Page, Slides)
- Control Flow - Use conditionals and loops (Page, Slides)
- ggplot2 - Create clear and effective graphics (Page, Slides)
- Vectorization - Write faster, cleaner code (Page, Slides)
- Functions - Build and use your own functions (Page, Slides)
- Writing Data - Export and save your data (Page, Slides)
- dplyr - Wrangle data with verbs and pipes (Page, Slides)
- R Markdown - Create reports with code and text (Page, Slides)
- Writing Good Software - Write readable, maintainable code (Page, Slides)
About These Lessons
These materials are designed as a supplementary resource for R programming workshops and independent learning. Whether you're an instructor teaching a workshop or a student learning on your own, you'll find:
- Web pages - Perfect for reading and reference
- Slides - Great for following along during live instruction
Use whichever format works best for your learning style!
About Quarto & the Slides
This whole site is built with Quarto - an open-source publishing system that turns plain text into websites, slides, PDFs, and more. Think of it as a modern, flexible way to write and share content without needing separate tools for each format.
The slide decks use Quarto's reveal.js format, and they're honestly pretty cool:
- Navigate horizontally through main topics or vertically through sub-topics
- Press F to go full screen
- Press S to open speaker/presentation mode (with notes and a timer)
- Hit E to switch to a PDF-friendly view, then print or save as PDF
- Built-in chalkboard to draw on slides during a live session
It's an excellent setup for teaching - everything lives in one place, looks clean, and just works in the browser. No PowerPoint needed.
Who Is This For?
- Instructors: Use these materials for teaching R programming workshops
- Students: Follow along during class or work through lessons independently
- Self-learners: Build your R programming skills at your own pace
Getting Started
No installation required! Simply visit the website and start learning.
To follow along with the lessons, you'll need:
- R (version 4.0 or higher)
- RStudio (recommended)
- The gapminder package:
install.packages("gapminder")
Credits
- Original Content: Software Carpentry's R for Reproducible Scientific Analysis
- Adaptation: Samuel Bharti
- AI Assistance: Generated and adapted with GitHub Copilot
License
This work is licensed under CC BY 4.0, following Software Carpentry's licensing. You are free to share and adapt these materials with attribution.
For Developers
Quick notes for contributors:
- Source lessons live in lessons/ and slides/.
- Lesson pages render to docs/lessons and slide decks render to docs/slides.
- The slide assets in docs/slides/site_libs must be committed for GitHub Pages.
Project Structure
โโโ index.qmd # Homepage (renders to docs/index.html)
โโโ lessons/ # Lesson source files (.qmd)
โ โโโ exploring_dataframes.qmd
โโโ docs/ # Generated website (for GitHub Pages)
โ โโโ index.html
โ โโโ lessons/
โ โโโ exploring_dataframes.html
โโโ _quarto.yml # Website configuration
Build the Website
Render the lesson pages:
quarto renderThen render the slides:
cd slides
quarto render
cd ..Or do both in one go:
# Bash
quarto render && cd slides && quarto render && cd ..# PowerShell
quarto render; Push-Location slides; quarto render; Pop-LocationDeploy to GitHub Pages
- Build the site:
quarto render - Push to GitHub:
git add . git commit -m "Update website" git push origin main
- Enable GitHub Pages:
- Go to repository Settings > Pages
- Source:
mainbranch - Folder:
/docs - Save
Your site will be at: https://samuelbharti.github.io/r-for-beginners/
Add More Lessons
- Create new
.qmdfile inlessons/directory - Add to navbar in
_quarto.yml - Run
quarto render