Let's get R running on your machine. I promise this part is quick — you'll be typing R commands in about five minutes.
Installing R
Head over to cran.r-project.org and download the version for your operating system (Windows, Mac, or Linux). Run the installer with the default settings — you don't need to tweak anything. Once it's done, you'll have the R console, which looks like a plain terminal window with a blinking > prompt.
You can type commands right there, but most people prefer to use RStudio. Go to posit.co and download the free RStudio Desktop. Install it and you'll get a much friendlier workspace.
# Type this in the R console or RStudio
print("R is alive!")
Try it Yourself →
Your First R Command
Open RStudio and look at the console panel (usually on the left). You'll see a > prompt. That's R asking you what to do next. Type something and hit Enter — R will evaluate it and print the result.
The console is your playground. You can type expressions, call functions, and see results immediately. There's no compile step. You type, R answers. It's that fast.
# Try typing these one at a time
3 + 5
10 * 2
"hello"
Try it Yourself →
Scripts vs Console
Typing in the console is fine for quick tests, but for real work you'll write scripts — text files with .R extension that contain all your commands. In RStudio, click File → New File → R Script, and a blank editor opens. Write your code there, then highlight it and click Run (or press Ctrl+Enter) to send it to the console.
Scripts are reusable. Save one, share it, run it again later. That's the professional way to work.
# This whole block can run together
numbers <- c(1, 2, 3, 4, 5)
sum(numbers)
mean(numbers)
Try it Yourself →
That's it — R is installed and you've run your first commands. Next up, we'll look at R's basic syntax so you can start talking the language.