Exercise path · R
10 R exercises, in order
From your first line to a complete program you assembled yourself. Each exercise introduces exactly one new idea, runs in this tab, and tells you in plain language what happened.
How the path works
You never start from a blank editor. Every exercise hands you a program that already runs and asks you to change or add one thing, so the first success is minutes away and the last exercise is a program you can read top to bottom and explain. The ideas arrive in this order: a complete program, variables, numbers and arithmetic, conditionals, string formatting, loops, collections, loops and collections, accumulation, putting it all together.
Run is the check. There is no separate submit button: press Run, and the output is compared with what the exercise asked for. When it is not right, the feedback is a sentence about what happened — the line that differed, or what the error means — rather than a verdict. Hints come one at a time, and the answer opens only after you have run your code at least once, because reading the answer first is how you learn nothing.
Your finished exercises and the code you last had in the editor are saved in this browser, so a half-done exercise is still there tomorrow. Nothing is uploaded and there is no account.
The exercises
- Say Hello with cat()A tiny script that prints two lines of welcome text to the console.New idea: Printing text with cat()
- Greet a Learner by NameA one-line personalized greeting built from a value stored in a variable.New idea: Assigning values with <-
- Add Up Two PricesA small script that adds two prices together and prints the total.New idea: Arithmetic operators (+, -, *, /)
- Check the TemperatureA short program that checks a temperature and prints whether it counts as a hot day.New idea: if / else branching
- Format an Order LineA program that builds one clean, formatted sentence out of separate pieces of text and numbers.New idea: Building formatted strings with paste0()
- Count from One to FiveA short program that prints the numbers 1 through 5, one per line, using a loop.New idea: for loops over a numeric range (1:n)
- Read Values from a VectorA program that stores several temperature readings in one vector and prints specific ones by position.New idea: Vectors with c() and 1-based indexing
- Loop Over a Price ListA program that prints every price in a list, one per line, alongside its position.New idea: Looping over a vector with length()
- Total the DonationsA program that adds up a list of donation amounts using a loop and prints the grand total.New idea: Accumulating a running total in a loop
- Build a Grade ReportA small grade report that labels each score as Pass or Fail and prints the class average, using everything from earlier exercises together.New idea: Combining loops, conditionals, a vector, and formatted output in one program
After the path
The R playground is where to build something of your own, and the R guide sets out a learning order for everything after the basics. Everything you can practise R with on this site is gathered on the R practice hub. The same path also exists in Python, JavaScript, TypeScript, Java, C++, C, C#, Go, PHP, Ruby, SQL and Bash & the Shell.