Skip to content
Justice Tech School

R Arrays and Factors

An array has more than two dimensions. A factor stores categories with a fixed set of levels, common in statistics.

Example
f <- factor(c("low", "high", "low", "mid"), levels = c("low", "mid", "high"))
print(levels(f)); print(table(f)); print(as.integer(f))

Exercise

Categorical type.

(c("a", "b"))

Quiz Test

What is a factor?

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