Tsallaka zuwa abun ciki
Justice Tech School

Vectors

A vector is the basic R structure. c() combines values. All items share a type.

Example
v <- c(10, 20, 30)
print(v)
print(length(v))
print(v[2])
print(c(v, 40))
print(c(1, "a", TRUE))

Exercise

Combine values.

v <- (1, 2, 3)

Quiz Test

Are R indexes 1 based?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.