c(), seq(), rep()

Vectors are the fundamental data structure in R. All elements must be the same type. Key creation functions: c(), seq(), rep(). Arithmetic is vectorised — no loops needed for element-wise operations.

basics
Key fns: c() — combine seq(from, to, by) rep(x, times) length() sum() / mean() / sd()
# Create vectors
v <- c(3, 1, 4, 1, 5, 9, 2, 6)
s <- seq(1, 10, by = 2)          # 1 3 5 7 9
r <- rep(c("a", "b"), times = 3) # a b a b a b

# Vectorised arithmetic
v * 2
v + s[1:length(v)]

# Summary statistics
length(v); sum(v); mean(v); sd(v); var(v)
range(v); min(v); max(v)

# Sorting and ordering
sort(v)
order(v)          # indices that would sort v
rev(v)

# Logical tests
v > 3             # returns logical vector
which(v > 3)      # indices where TRUE
any(v > 8); all(v > 0)