Learn R Programming

neatStats (version 1.8.1)

enum: Enumerate

Description

Aids enumeration and merging (via rbind_loop) in loops: adds numbers to a vector input, and indicates loop start for rbind_loop.

Usage

enum(items, hush = FALSE, enumerate = TRUE)

Arguments

items

The items to be enumerated in the loop.

hush

Logical. If TRUE (default), prints "Loop started." when executed.

enumerate

Logical. If TRUE (default), adds numbering to the input vector (in item pairs, see Examples). If FALSE, returns the original input.

Value

Vector with numbers added (if so set).

See Also

rbind_loop

Examples

Run this code
# NOT RUN {
my_vector = c('aa', 'bb', 'cxyz', 'last')

for (item in enum(my_vector)) {
    print(item)
}

# just to show what enum() returns
enum(my_vector)

# }

Run the code above in your browser using DataLab