Learn R: programming for beginners
Where should I begin learning R?
Chapters 1 and 2 start with R, a language for calculations and graphs. Follow short instructions to draw 6 heights, then name and select them.
On this page
I'm Bob. If you have opened R and wondered where you are supposed to type, or copied two lines only to get an unfamiliar error, this is a place to start. I'll show you where the code goes, how to run it and what you should see when it works.
When I was a student, I got stuck trying to make a graph and couldn't find the instructions I needed online. Having the data in front of me without knowing how to turn it into the figure I wanted was frustrating. That experience is why I started this site. In these lessons, I want you to have somewhere to look when you get stuck, with a specific thing to check next.
Chapters 1–3 are ready. In chapter 1, add six heights and divide by six to find their average, then draw them as points. In chapter 2, keep the values together, name them and pick the ones you need. Chapter 3 puts names and heights into a table and uses its columns to draw a graph. Later chapters will open saved tables, compare groups and save finished graphs.
How can I follow along without any coding experience?
Run a short piece of code, compare the result, then change one thing; come back to the explanation whenever you need it.
We start by meeting R, entering an addition and keeping six heights together. I explain each new term before we use it, then show what to type and what should appear. Even the mean starts with “add the values and divide by their count.” Take the steps at your own pace and return to an explanation whenever you need it.
If all you do today is get R to calculate 2 + 3, you can stop there. Next time, you'll already know where to type a command. When your first graph appears, save the script. You'll have something of your own to return to and change.
Which chapter can I read now?
Chapters 1–3 are ready in five languages.
Chapter 1: run your first R code and draw a graph
Chapter 2: R vectors, names and selecting values
Chapter 3: put names and heights into an R data frame
What will I learn after chapter 3?
Chapter 4 will open a saved table file and check missing values. Chapters 4–12 are planned.
- Open a table file with comma-separated columns (CSV) and find missing values
- Pick rows, then arrange them by size or category
- Turn repeated steps into a reusable operation (a function)
- Use point positions to show two numbers (a scatter plot)
- Compare groups and read lines showing value ranges (error bars)
- Edit chart text and color explanations (labels and legends)
- Arrange several graphs on one canvas
- Save an image at the width and height you need
- Make a complete graph yourself, from data through code
Learn R