# Using the assignment operator (<-)
<- 10
x <- "Hello, R!"
y <- TRUE
z
# Print the variables
x
[1] 10
y
[1] "Hello, R!"
z
[1] TRUE
March 30, 2025
Variables in R store data that can be referenced and manipulated throughout code. The following demonstrates how to create and work with variables:
Value
and value
are different variables)R has several basic data types:
[1] "numeric"
[1] 5
num [1:5] 1 2 3 4 5
Note that R is dynamically typed, so variables can change types during execution. This flexibility is one of R’s strengths for data analysis.