Простые типы

Инициализация типов

# Integer: the L suffix
number <- 42L

# Double: a plain number
other_number <- 37

# Hex literal and scientific notation
mb <- 0x100000
# mb = 1048576
billion <- 1e9
# billion = 1e+09

# Complex number
z <- 2 + 3i

# A string may span lines
greeting <- "Hello"
text <- "this is some
multiLine text"

sun_is_star <- TRUE
earth_is_star <- FALSE

# No char type: a string of length 1
char_a <- "A"  # also "\u0041"

# A vector literal, and no value at all
pair <- c(1L, 2L)
nothing <- NULL

cat("number =", number, "\n")
cat("other_number =", other_number, "\n")
cat("mb =", mb, "\n")
cat("billion =", billion, "\n")
cat("z =", z, "\n")
cat("greeting =", greeting, "\n")
cat("text =", text, "\n")
cat("sun_is_star =", sun_is_star, "\n")
cat("earth_is_star =", earth_is_star, "\n")
cat("char_a =", char_a, "\n")
cat("pair =", pair, "\n")
cat("is.null(nothing) =", is.null(nothing), "\n")