R has a reputation for being intimidating. People hear “programming language” and “statistics” in the same sentence and assume it’s not for them. But R is more approachable than it looks, and the payoff – free, powerful, reproducible data analysis – is enormous. This guide will walk you through everything you need to get started, from installation to your first reproducible document.
If you’ve been meaning to learn R but didn’t know where to begin, this is for you.
R and RStudio Are Two Different Things
The first source of confusion for almost every beginner is that you need to install two separate programs: R and RStudio. Why two?
Here’s the simplest way to think about it. R is the program – the actual engine that does the computation. It’s the language and the software that runs your code. RStudio is a GUI – a graphical interface that makes using R far easier. You could do everything with just R, running it on its own. But R by itself is a bare-bones experience: a single window where you type commands. RStudio wraps around R and gives you a proper workspace – panels for your code, your console, your data, your plots, your files – all visible at once.
The key point is that RStudio makes R easier without taking away the coding part. You’re still writing R code, still in full control. RStudio just gives you a comfortable dashboard to do it in. Think of R as the engine and RStudio as the whole car built around it: you could technically run the engine on its own, but the car is what makes it usable.
Install R first, then RStudio. The order matters, because RStudio looks for an existing R installation when it starts.
Installing R and RStudio
Installing both is straightforward and free.
Step 1 – Install R. Go to the Comprehensive R Archive Network, known as CRAN, at cran.r-project.org. Choose your operating system (Windows, macOS, or Linux), download the installer, and run it with the default settings. There’s nothing to configure – just click through.
Step 2 – Install RStudio. Go to posit.co/download/rstudio-desktop and download RStudio Desktop, which is free. Install it, and when you open it for the first time, it will automatically find your R installation and connect to it.
That’s it. Open RStudio, and you’re ready to start. You’ll see several panels – don’t worry about what they all do yet. The important one for now is the console, usually on the left, where you can type commands directly.
The Console vs Scripts
When you type a command into the console and press Enter, it runs immediately. Type 2 + 2 and you’ll see 4. This is great for quick, one-off tasks.
So when should you use the console, and when should you write a script? The distinction is simple and important.
Use the console when you want to run something just once – a quick calculation, a fast check of a statistical test, comparing two groups to each other on the spot. Throwaway work that you don’t need to keep.
Use a script whenever you want to keep your work. If you want to replicate your results later, if you want to continue working on the same analysis tomorrow, if you want to share what you did or simply be able to rerun it – a script is the minimum you need. A script is just a text file (with a .R extension) containing your commands, saved so you can open, edit, and rerun them anytime.
To create one in RStudio: File → New File → R Script. Type your commands there, and run them line by line (Ctrl+Enter, or Cmd+Enter on Mac) or all at once. The critical habit to build early is this: if it matters, put it in a script. The console is for exploration; the script is for anything you want to survive past this moment. This is the foundation of reproducible work – your script is the permanent, rerunnable record of exactly what you did.
Packages – R’s Superpower
Base R can do a lot, but its real power comes from packages – collections of functions written by the community to extend what R can do. There are thousands of them, covering everything from data manipulation to advanced psychometrics to interactive web apps.
Working with packages involves two commands that beginners constantly confuse, so let’s make the distinction crystal clear with an analogy.
install.packages("packagename") downloads and installs a package onto your computer. You do this once per package (and again only if you update your R version, which requires reinstalling). This is like buying a book for your library – once it’s on your shelf, it stays there.
library(packagename) activates the package for your current session. You do this every time you start R and want to use that package. This is like going to the shelf, taking the book down, and opening it to actually use the information inside. Installing the book doesn’t mean it’s open on your desk – you have to fetch and open it each time you sit down to work.
So the pattern is: install once, load every session. A beginner who runs install.packages() every single time wastes time re-downloading; a beginner who forgets library() gets errors saying functions can’t be found. Remember the analogy and you won’t mix them up.
As for which package to start with: the tidyverse is a must. It’s actually a collection of packages – including dplyr for data manipulation, ggplot2 for visualization, tidyr for reshaping data, and several others – all designed around a consistent, readable philosophy. Install it with install.packages("tidyverse") and load it with library(tidyverse). Almost everything you’ll want to do as a beginner is made easier by the tidyverse, and learning R through it is far gentler than learning through base R alone.
RStudio Projects – Keep Everything Together
Here’s something most beginners don’t learn early enough, and later wish they had: RStudio Projects.
A Project is a self-contained working environment tied to a specific folder. When you open a Project, RStudio sets everything up relative to that folder – your scripts, your data, your outputs all live together in one organized place.
Why does this matter? Because real work quickly becomes more than a single script. When a project grows – especially when you’re not just analyzing data but writing a whole document – there are many things to manage: data files, multiple scripts, graphs, output files, figures. A Project keeps all of it bundled together in one coherent unit.
Projects also make your work portable. Moving a project from one computer to another, or sharing it through the cloud, becomes much easier when everything is self-contained. You just move or share the folder, and everything works, because the Project doesn’t rely on hard-coded file paths specific to your machine. And once again, this serves replication – the key theme running through all good R practice. Someone else (or future you) can open the Project and pick up exactly where things left off.
To create one: File → New Project, choose a new or existing folder, and RStudio does the rest. Start using Projects from your very first serious piece of work. It’s a habit that pays off enormously and costs almost nothing to adopt.
Quarto – Write Your Entire Study in One Place
Once you’re comfortable with scripts, there’s a more powerful way to work: literate documents that combine your writing, your code, and your results in a single file. The current tool for this is Quarto (the successor to R Markdown, and what I recommend starting with today).
A Quarto document is a file you can render into HTML, PDF, or Word. But what makes it special is that it holds both your prose and your code together. You write your narrative text – your introduction, your methods, your discussion – in plain language, and you embed chunks of R code directly in the document. When you render it, the code runs, the results and figures are generated fresh, and everything is woven into a finished document.
This means you can write your entire study in Quarto without needing any separate word processing program. Your analysis and your write-up live in the same place. When your data changes, you re-render and every number, table, and figure updates automatically – no copying and pasting results from R into Word, no risk of your reported numbers falling out of sync with your actual analysis.
For reproducible research, this is transformative. The document is the analysis. Anyone who has your Quarto file and your data can reproduce your exact results and your exact write-up. For a beginner, you don’t need to master this on day one – but knowing it exists, and moving toward it, is one of the best things you can do for the quality of your work. Quarto is built into recent versions of RStudio, so you can create your first document through File → New File → Quarto Document.
Make R Your Own – Changing the Theme
Here’s a small thing that matters more than you’d expect: you can change how RStudio looks. By default it comes with a plain light theme, but RStudio ships with many built-in color themes, and switching is a one-minute change that can make long working sessions much more pleasant.
Go to Tools → Global Options → Appearance, and you’ll find a list of editor themes. Try a few and see what feels right.
My personal recommendation is Solarized. It’s simply beautiful, and more importantly it’s easy on the eyes – designed specifically to reduce strain during long sessions in front of a screen. I like it so much that I took its colors for this entire website and for all of my applications; the palette you’re looking at right now is Solarized. If you want to make R feel like yours, changing the theme is the easiest place to start. There are many other themes too, light and dark, so explore until you find one that fits you.
It seems trivial, but working in an environment that’s comfortable and feels personal makes a real difference in how much you enjoy learning – and enjoyment is what keeps you coming back.
Your First Steps
So here’s your roadmap. Install R, then RStudio. Open RStudio and play in the console to get a feel for it. Create your first script and save something. Install the tidyverse. Start a Project for your first real piece of work. When you’re ready, try a Quarto document. And set a theme you like along the way.
Don’t try to learn everything at once. R has a genuine learning curve, and the beginning is the hardest part. You’ll type commands that don’t work. You’ll get error messages that make no sense. This is normal – it happens to everyone, including people who’ve used R for years.
But with practice, it gets easier. And there’s a real satisfaction that comes with R – when you write something that works, when you produce a clean figure or run an analysis you couldn’t have done before, there’s a genuine feeling of accomplishment to it. That feeling is what carries you from struggling beginner to confident user.
Start small, be patient with yourself, and keep going. The effort is worth it.
—
Giorgi Tchumburidze
July, 2026