| Function | Example | Result |
|---|---|---|
seq |
seq(1, 10, 1) |
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 |
rep |
rep(1, 10) |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1 |
Sequence Generation
Generate regular sequences. seq is a standard generic with a default method. seq.int is a primitive which can be much faster but has a few restrictions. seq_along and seq_len are very fast primitives for two common cases.
Replicate Elements of Vectors and Lists
rep replicates the values in x. It is a generic function, and the (internal) default method is described here.
rep.int and rep_len are faster simplified versions for two common cases. They are not generic.