411 REFERENCE · Wikibooks
Statistical Analysis: an Introduction using R/R/Lists
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
R is very particular about what can be contained in a vector. All the elements need to be of the same type, an moreover must be either types of numberThere are actually 3 types of allowed numbers: "normal" numbers, complex numbers, and simple integers. This book deals almost exclusively with the first of these., logical values, or strings of textThis is not quite true, but unless you are a computer specialist, you are unlikely to use the final type: a vectors of elements storing "raw" computer bits, see ?raw.
If you want a collection of elements which are of different types, or not of one of the allowed vector types, you need to use a list. l1 <- list(a1, b1:3)
l2 <- c(sqrt, log) #
Notes