
Last chance! 50% off unlimited learning
Sale ends in
`enum()` is creating a vector of integers to enumarate items in an object. It is particularly useful in the `for(i in enum(object))` construct.
enum(x)
Any object.
[seq_along()]
enum(letters)
enum(numeric(0))
# Compare with:
1:length(numeric(0))
enum(NULL)
letters5 <- letters[1:5]
for (i in enum(letters5)) cat("letter", i, "=", letters5[i], "\n")
Run the code above in your browser using DataLab