x <- 5
x = 4
x <- y <- 3
<-
and =
are ok. Choose one you prefer.x,y = 1,2
), which is available in Python.In R, there are 6 atomic types: integer, double, logical, character, complex, raw.
Numeric contains integer and double.
You can use function typeof(var_name)
or is.xxx(x)
to check the variable’s type.
> typeof(1)
[1] "double"
> typeof(1L)
[1] "integer"
> typeof("qqq")
[1] "character"
> typeof(TRUE)
[1] "logical"
> is.integer(1)
[1] FALSE
> is.integer(1L)
[1] TRUE
4.5
are called doubles.
4
are called integers.