I was working my way through a primer on R programming and noticed a slight anomaly :
x <- c(2,1,1,5)
produces a vector of typenum
y <- c(1:5)
produces a vector of typeint
z <- c(1.5,2.3)
produces a vector of typenum
Why does this happen ? What is the fundamental data type in R
: is it int
or is it num
? What happens if one of the elements in the vector is a float
, does the type of the vector become float
or is it something else ? What happens when all the elements in the vector are float
- why is it still num
in that case ?