Like many other languages, R has a variety of basic types and more complex types that can be created from the 'atomic' ones. Basic types in R are:
- numeric (real)
Creating a variable of a specific type can be done by using assign
num <- 10
For initialising text variable you can use both ' and ":
chr <- "some text"
Logical values can be created using
FALSE or just
log <- TRUE
Notice that R is dynamic when it comes to types, so you can assign character value to the variable that previously was set to different type:
myVar <- 10
myVar <- 'text value'