seq_along_dim | R Documentation |
Sequence along a dimension
seq_along_dim(x, which_dim)
seq_along_rows(x)
seq_along_cols(x)
x |
a dataframe, array or vector. For |
which_dim |
a scalar integer or character string, specifying which dimension to generate a sequence for. Negative numbers count from the back. |
a vector of integers 1:nrow(x), safe for use in for
loops and
vectorized equivalents.
for (r in seq_along_rows(mtcars[1:4,]))
print(mtcars[r,])
x <- 1:3
identical(seq_along_rows(x), seq_along(x))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.