← R Programming learning pathR Programming · Module 2 of 10
Data types and vectors
Work with vectors, the basic building block of R.
📖 Key ideas
- Basic types: numeric, integer, character, logical, factor.
- Create vectors with c(1, 2, 3).
- Operations are vectorised: c(1,2,3) * 2 gives 2 4 6.
- Index from 1: x[1] is the first element.
- NA represents missing values.
💡 Real-life example: A vector is a train where every coach carries the same type of cargo.
VectorSequence of same-type values
c()Combines values into a vector
NAMissing value
FactorCategorical variable