Tsallaka zuwa abun ciki
Justice Tech School

Sequences and Sorting

seq makes sequences, rep repeats, sort orders a vector, order gives positions and rev reverses.

Example
print(seq(0, 1, length.out = 5)); print(rep(c("a", "b"), times = 2))
x <- c(3, 1, 2); print(sort(x, decreasing = TRUE)); print(order(x))

Exercise

Reverse order sort.

sort(x,  = TRUE)

Quiz Test

Which gives positions that sort a vector?

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