Ready, set, go!
On R-exercises, you will find more than 4,000 R exercises. We’ve bundled them into exercise sets, where each set covers a specific concept or function. An exercise set typically contains about 10 exercises, progressing from easy to somewhat more difficult. In order to give you a full picture of all the amazing content on this website, we’ve categorized all sets into broader topics below.
Start at the beginning, or anywhere you want
If you’re completely new to R, we suggest you simply start with the first topic, “Vectors”. Once you’ve managed to work through all exercise sets, from top to bottom, you should have a fair amount of knowledge of, and practical experience with, using R. Of course, those of you who are familiar with R already, can jump straight to any of the topics below.
Start Here To Learn R Books
For an even better experience, we recommend our Start Here to Learn R books.
Subscribe and share
New exercise sets are added on a daily basis. Read Why exercise and Celebrating our 100th Exercise Set to better understand our philosophy. If you enjoy our exercises, please share this page with your friends. If you’re a college student and enjoy our exercises, you can help your fellow students by asking your TA or professor to add a link to R-exercises on your department’s webpage with R resources.
Have fun!
Exercise sets by Topic
- Vectors [creating vectors] [working with vectors] [vectors and functions] [tutorial] [vol. 1] [vol. 2]
- Regular sequences [vol. 1] [vol. 2]
- Logical vectors and operators
- Missing Values
- Character vector exercises
- Index vectors
- [BONUS] Comparing Vectors *
- Factor Exercises
- Using factor variables like a pro [Part 1] [Part 2]
- Facing the Facts about Factors
- Fighting Factors with Cats
- Working with Factors
- Matrix exercises [vol. 1] [vol. 2]
- Array exercises
- Bind exercises
- Matrix operations
- List Exercises [vol. 1] [vol. 2]
- Know your lists
- Data Frames [vol. 1] [vol. 2] [BONUS]
- Merging Dataframes Exercises
- Accessing Dataframe Objects Exercises
- Apply functions to lists
- Reading delimited data
- Scan exercises
- R-SQL
- Web scraping
- Easy Web Scraping With Rvest
- Harvesting Data from the Web with Rvest
- [BONUS] Loading data from the web *
- [BONUS] Obtaining Twitter Data Exercises *
- R with Remote Databases [part 1] [part 2]
- Tidy Data Reading
* Subscribe for free to access BONUS exercises and receive our weekly newsletter.
- Regular expressions part 1
- Regular Expressions Fundamentals
- String manipulation
- [BONUS] Working with tm package and wordclouds *
- [BONUS] Character Functions *
- [BONUS] Character Functions (intermediate) *
- Character Functions (advanced)
- [BONUS] Introduction to Text Mining *
- Hacking Strings with stringr
- Stringr Basic Functions
- Pull the Right Strings with Stringr
- Hacking Strings with stringi
- More string Hacking with Regex and Rebus
- Text Data Wrangling
* Subscribe for free to access BONUS exercises and receive our weekly newsletter.
- data exploration with table
- Complex tables
- Cross Tabulation with Xtabs
- Interactive Data Tables with DT [tutorial] [part 1]
- Get-your-stuff-in-order-exercises
- Basic operations
- Summary statistics with aggregate()
- [BONUS] Introduction to working with categorical variables *
- Data Shape Transformation With Reshape()
- Interactive Subsetting exercises
- Reshape 2 exercises
- Efficient data processing with apply
- Optimize data processing with sapply
- [BONUS] Working with vapply *
- Multivariate apply
- [BONUS] Data aggregation with tapply *
- Sampling exercise [part 1]
- Select and query
- Let’s get started with dplyr
- dplyr basics: More smooth data exploration
- dplyr basic functions [tutorial] [part 1]
- dplyr non-standard evaluation
- Melt and Cast The Shape of Your Data-Frame
- [BONUS] Tidy the data up! *
- How to Tidy Up your Dataset [tutorial] [part 1]
- Data Hacking with RDSTK [part 1] [part 2] [part 3]
- Data Wrangling [part 1] [part 2] [part 3] [part 4] [part 5] [part 6] [part 7] [part 8] [part 9] [part 10]
- [BONUS] Dummify your Data *
* Subscribe for free to access BONUS exercises and receive our weekly newsletter.
- Data table exercises: keys and subsetting
- Data Manipulation with data.table [part 1] [part 2]
- Basics of data.table: Smooth data exploration
- Beyond the basics of data.table: Smooth data exploration
- Sharpening the Knives in the data.table Toolbox
Reproducible reporting
- RMarkdown [Tutorial] [part 1] [part 2]
- Use KableExtra and RMarkdown to Create Tables in PDF Documents [tutorial] [part 1]
- As.Date()
- Lubridate [part 1] [part 2] [part 3]
- zoo time series exercises
- Parsing Dates and Time [part 1] [part 2] [part 3]
- Tidy Date/Times
- Combinations exercises
- Lets Begin with something sample
- Generating data
- Answer probability questions with simulation [part 1] [part 2]
- Probability Functions – Beginner
- Probability Functions – Intermediate
- Probability Functions – Advanced
Loops and conditional execution
- Conditional execution exercises [vol. 1] [vol. 2]
- Scripting Loops in R [vol. 1]
- Loops in R
- [BONUS] Simplifying For loops *
* Subscribe for free to access BONUS exercises and receive our weekly newsletter.
- Functions exercises [vol. 1] [vol. 2]
- Higher order functions
- User Defined Functions
- A Primer in Functional Programming in R [part 1] [part 2]
- [BONUS] Working with Custom Functions *
- Well-Behaved Functions
- Start plotting data!
- Customize a scatterplot exercises
- Replicating plots: Boxplot
- Advanced base graphics
- [BONUS] Statistical Graphics *
- Graphics parameters exercises
- 3D plotting exercises
- GGplot Drilling
- Practice Your ggplot Skills
- Igraph Network analysis [part 1] [part 2] [part 3]
- Graph Theory: Using iGraph [part 1] [part 2]
- Shiny Apps[part 1] [part 2] [part 3] [part 4] [part 5] [part 6] [part 7] [part 8] [part 9] [part 10]
- Shiny Apps Layout [part 1] [part 2] [part 3] [part 4] [part 5] [part 6] [part 7] [part 8] [part 9] [part 10]
- Prettify your Shiny Tables with DT
- Modularize your Shiny Apps
- GoogleVis [part 1] [part 2] [part 3] [part 4] [part 5] [part 6] [part 7] [part 8] [part 9][part 10]
- GGvis [tutorial] [Part 1] [Part 2]
- [BONUS] Shiny html tags *
- Shapefiles
- Getting started with Plotly: basic plots
- Plotly: advanced plots and features
- Plotly basic charts [tutorial] [part 1]
- Lattice graphs [part 1] [part 2]
- Graphics with Lattice [part 1] [part 2]
- Display multivariate relationship graphs with lattice [tutorial] [part 1]
- [BONUS] Rebuilding a Figure *
- Multi-panel Graphics
- Spatial Analysis with ggmap
- iPlots [tutorial] [part 1]
- Plotting Interactive Maps With Leaflet [tutorial] [part 1]
- [BONUS] Geo Mapping with Leaflet *
- Specialize in Geo-Spatial Visualizations With Leaflet [part 1] [part 2]
- Visualize Data With Highcharter [tutorial] [part 1]
- Plot With Metricsgraphics [tutorial] [part 1]
- Plot With Ggiraph [tutorial] [part 1]
- Plot with Dygraphs [tutorial] [part 1]
- Plot with Patchwork [tutorial] [part 1]
- Create a Flexdashboard [tutorial] [part 1]
- Step Up Your Dashboard With Shinydashboard [part 1] [part 2]
- Visual Data Exploration
- Mathematical Expressions in R Plots [tutorial] [part 1]
* Subscribe for free to access BONUS exercises and receive our weekly newsletter.
Statistical Testing
- Independent t-test
- Paired t-test
- Nonparametric tests
- Frequency and chi-square test for independence
- Introduction to Statistical Testing and Sampling [part 1] [part 2]
Experimental Design and Analysis
- One way ANOVA in R
- Two way ANOVA in R
- Repeated measures ANOVA in R
- Groups Comparison with ANOVA [part 1] [part 2]
- One Way MANOVA
- Modeling with ANCOVA [part 1] [part 2]
- Experimental Design
- Bayesian A/B Testing Made Easy
- Power Analysis [tutorial] [part 1]
- Examining data
- [BONUS] Basic Data Exploration in Base R Exercises *
- [BONUS] Descriptive statistics *
- [BONUS] Working with and visualizing a confidence interval *
- Model evaluation [part 1] [part 2]
- Evaluate your Model with R
- Basic tree [part 1] [part 2]
- Intermediate tree [part 1] [part 2]
- Recursive partitioning and regression trees
- Intro to FFTree
- [BONUS] Evaluating a linear time series model *
- Exploratory Factor Analysis
- Hierarchical clustering
- Density-based Clustering
- K-Means Clustering in R
- [BONUS] ROC curves *
- Correlation and Correlogram
- Introduction to Copulas [part 1] [part 2]
- Tidy Modeling
- Tidy Model Results
- Survival Analysis [part 1] [part 2] [part 3]
* Subscribe for free to access BONUS exercises and receive our weekly newsletter.
Regression
- Multiple regression [part 1] [part 2]
- Regression Model Assumptions [tutorial] [part 1]
- Predicting Housing Prices with Linear Regression
- Generalized Linear Functions – Beginner
- Logistic regression in R
- Quantile regression
- Lasso regression
- Ridge regression
- Instrumental Variables [part 1] [part 2] [part 3]
- Calculating Marginal Effects
- Polynomial Model in R – Study Case
- Non-linear Models
- Basic Generalized Models in Ecology
- Basic Generalized Linear Modeling [part 1] [part 2] [part 3] [part 4]
Machine Learning
- Machine Learning [tutorial] [Part 1] [Part 2] [Part 3]
- Neural Networks [part 1] [part 2] [part 3]
- Building a Neural Network Using the Iris Data Set
- Call Center Productivity Boosting with ML
- eXtremely Boost your machine learning [part 1] [part 2]
Bayesian statistics
- Basic Bayesian Inference for MCMC Techniques [part 1] [part 2]
- MCMC for Bayesian Inference – Metropolis
- MCMC for Bayesian Inference – Gibbs Sampling
- Bayesian Inference – MCMC Diagnostics using coda
- Bayesian Inference Using the MCMCglmm Package
- MCMC Using Stan – An Introduction With The RStan Package
- MCMC Using Stan – An Introduction With The RStanarm Package
- MCMC Using Stan – Diagnostics with the Bayesplot Package
- MCMC Using Stan – Visualization with the Shinystan Package
- Time Series Exploration
- Intro to Time Series Analysis [part 1] [part 2]
- Linear Trend and ARIMA Models
- Exponential Smoothing
- Multivariate Regression
- ARIMAX model
- Forecasting for Small Business [part 1] [part 2] [part 3] [part 4]
- Basic Time-series Hydro-logical Data Analysis [part 1] [part 2]
- Half Hourly Hydrological Dataset Analysis and Visualization
- Resampling Time Series Datasets in Hydrology
- Analysis of stock prices [part 1] [[part 2] [part 3]
- Shares analysis using Quantmod package
- using MANOVA to analysis the banking crisis
- Volatility modelling in R [part 1] [part 2] [part 3] [part 4]
- Analyzing Crypto-currency Data with R
Parallel Computing
Big Data
- Big Data Manipulation
- Big Data analytics with RevoScaleR [part 1] [part 2]
- Big Data analytics with H2O [part 1] [part 2]
- Applying Machine Learning with H2O [part 1] [part 2] [part 3]
- Add Some Spark to Your Analysis – Sparklyr [part 1] [part 2] [part 3]
Tensorflow
- Tensorflow Basics 1 [tutorial] [part 1]
- Tensorflow Basics 2 [tutorial] [part 1] [part 2]
- Linear Regression in Tensorflow [tutorial] [part 1]
- Logistic Regression in Tensorflow [tutorial] [part 1]
- Tensorflow – Neural Network Training
Coding
- Best practices while writing R code Exercises
- Unit Testing in R using testthat
- So You Think Your Code is Efficient
- Style-Consistent Code: Exercises
Geospatial data
- Use Environmental Data With Ropenaq [tutorial] [part 1]
- plot Air Pollution Data with Openair [tutorial] [part 1]
- Working with Air Quality and Meteorological Data [part 1] [part 2] [part 3] [part 4] [part 5] [part 6] [part 7] [part 8] [part 9] [part 10]
- Spatial Data Analysis: Introduction to Raster Processing [tutorial 1] [tutorial 2] [exercises] [tutorial 3] [tutorial 4]
- Advanced Techniques with Raster Data [tutorial 1] [tutorial 2] [exercises]
- Advanced Raster Data
- Simple Spatial Modeling [part 1] [part 2] [part 3]
Other
- Bioinformatics Tutorial with Exercises in R [part 1]
- [BONUS] Students’ Achievements Research Project *
- Data Science for Operational Excellence [part 1] [part 2] [part 3] [part 4] [part 5]
- Accessing and Manipulating Biological Databases [part 1] [part 2] [part 3]
- Manipulate Biological Data Using Biostrings Package [part 1] [part 2] [part 3] [part 4]
- Canada Labour Market: Future Perspectives
- Canada Immigration: Where to Settle In?
- Soccer data sparring: Scraping, merging and analyzing exercises
- Basic R For Stata Users
- Create and Format a Google Sheet Within R
- Programmatically Creating Text Outputs
- [BONUS] Introduction in working with categorical variables *
- [BONUS] Built-in Numerical Functions *
- Simple Numerical Modeling in R [part 1] [part 2]
- Numerical Analysis using R
- Sending Emails from R
- Applied Economic Analysis with R
- Image Recognition With Google Vision API
- Image processing
- Word Embedding
- Tidy Text Mining
- [BONUS] Sentiment Analysis using TidyText *
- Functional Programming With Purrr [part 1] [part 2]
- UFC Analytics
- Automating and Scheduling R Scripts in Windows: Tutorial
* Subscribe for free to access BONUS exercises and receive our weekly newsletter.
Stand alone series: Data preparation made simple
- Descriptive analytics, Part 0: Data Exploration
- Descriptive analytics, Part 1: Data Formatting
- Descriptive analytics, Part 2: Data Imputation
- Descriptive analytics, Part 3: Outlier Treatment
- Descriptive analytics, Part 4: Data Manipulation
- Descriptive analytics, Part 5: Data visualisation (continuous variables)
- Descriptive analytics, Part 5: Data visualisation (categorical variables)
- Descriptive analytics, Part 5: Data visualisation (spatial data)
- Descriptive analytics, Part 6: Interactive dashboard [part 1] [part 2]
Stand alone series: Data Science for Doctors
- Data Science for Doctors, Part 1: Data Display
- Data Science for Doctors, Part 2: Descriptive Statistics
- Data Science for Doctors, Part 3: Distributions
- Data Science for Doctors, Part 4: Inferential Statistics [part 1] [part 2] [part 3] [part 4] [part 5]
- Data Science for Doctors, Part 5: Cluster Analysis
- Data Science for Doctors, Part 6: Variable Importance
- How I Learned to Stop Worrying About Calculus and Love Stats Exercises [part 1]
- How I Learned to Stop Worrying About Calculus and Love Stats Exercises [part 2]
- How I Learned to Stop Worrying About Calculus and Love Stats Exercises[part 3]
- How I Learned to Stop Worrying About Calculus and Love Stats Exercises[part 4]
- How I Learned to Stop Worrying About Calculus and Love Stats Exercises[part 5]
- How I Learned to Stop Worrying About Calculus and Love Stats Exercises[part 6]
- How I Learned to Stop Worrying About Calculus and Love Stats Exercises[part 7]
- How I Learned to Stop Worrying About Calculus and Love Stats Exercises[part 8]
- How I Learned to Stop Worrying About Calculus and Love Stats Exercises[part 9]
Standalone Series: R for Hydrologists
- Loading and Plotting Data [part 1] [part 2] [part 3]
- Correlation and Information Theory Measurements [part 1] [part 2] [part 3]
- Seasonality and Trend Decomposition
Hello,
The exercises on r programming websites are just fantastic! These exercises help us test our understanding on the subject and more importantly makes us learn! Thank you so much!!
Hi, I am stuck with functions. Can you help me ?
Wow! Thank you for making all of this!