Understanding how to declare and use variables in R
In R, you can declare variables using the assignment operator (<-) or with the = sign.
x <- 10 y = "hello" z <- TRUE
Variable names in R are case-sensitive and can contain letters, numbers, periods, and underscores. They cannot start with a number or contain spaces.
myVariable <- 20 another.variable <- "world" third_variable <- FALSE
Now that you've learned about variables in R, it's time to practice. Try the following exercises to test your understanding:
age and assign your age to it.name and assign your name to it.isStudent and assign TRUE if you are a student, or FALSE otherwise.