Hello,
In regards to your questions:
- Vectors in R are indeed all of the same class, but it is perfectly possible to have lists containing different classes in R as well.
vec = c(1, "A", T)
sapply(vec, class)
#> 1 A TRUE
#> "character" "character" "character"
lst =list(1, "A", T)
sapply(lst, class)
#> [1] "numeric" "character" "logical"
Created on 2022-04-03 by the reprex package (v2.0.1)
- R is based on Fortran, a language that also has indexing 1 the same as other related languages like Matlab. Since these languages are more used by mathematicians / statisticians, indexing starting at 1 is more logical as this is the way it is defined in mathematics
Hope this helps,
PJ