2+2[1] 4
Alert - Course 1: Wednesday, 17 December 2025 at 18:00 CEST.
Introduction to R Programming Environment
Welcome to the “Getting Started with R and RStudio” guide! This guide is designed to help beginners set up their R programming environment and get familiar with the basics of R and RStudio.
Install R:
Install RStudio:
Launch RStudio: Open RStudio after installation. You should see the RStudio interface with multiple panes.
The RStudio interface consists of several key panes:
In the Source Pane, click on “File” > “New File” > “R Script” to create a new R script.
Type the following code into the script:
2+2[1] 4
Ctrl + Enter (Windows) or Cmd + Enter (Mac). You should see the output 4 in the Console Pane.Here are some basic R commands to get you started:
x <- 10
y <- 5sum <- x + y
product <- x * ymy_vector <- c(1, 2, 3, 4, 5)print(my_vector)[1] 1 2 3 4 5
R has a vast ecosystem of packages that extend its functionality. To install and load packages, follow these steps:
install.packages() function. For example,install.packages("ggplot2")library() function:Now that you have set up R and RStudio and learned some basic commands, you can explore more advanced topics in R programming and data analysis. Check out the next guide in this series, From Basics to Advanced Health Analytics: Exploring Diabetes Data, to dive deeper into data analysis using R.