In R, variable assignment is typically done using either the <- operator or the = operator. Here are examples of both: Using <- (recommended in R):
x <- 10 name <- "Patrick Mensah" numbers <- c(1, 2, 3, 4, 5)
Using = (an alternative way): x = 10 name = "Patrick Mensah" numbers = c(1, 2, 3, 4, 5)
age <- 25
name <- "Patrick Mensah"
scores <- c(88, 92, 79, 85)
In R, <- is more common and preferred because it makes assignments more explicit, distinguishing them from other operators.