← R Programming learning path
R Programming · Module 2 of 10

Data types and vectors

Work with vectors, the basic building block of R.

📖 Key ideas

  1. Basic types: numeric, integer, character, logical, factor.
  2. Create vectors with c(1, 2, 3).
  3. Operations are vectorised: c(1,2,3) * 2 gives 2 4 6.
  4. Index from 1: x[1] is the first element.
  5. 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