Variable Assignment
Assigning variables and numeric data types
x <- 10 y <- 5 x + y z <- x + y a <- z - x b <- y / z c <- x^3 d <- a * b * c # Check class of object class(a)
Character Strings
a <- "Hello" class(a) textString <- paste("The result of your calculation is", d) textString n <- "85" class(n) n <- as.numeric(n) class(n) n <- as.character(n) class(n) n + 1 # should generate an error since you can do arithmetic on character string as.numeric(n) + 1