R: ID By Row Number or Sequence Along

id {qdapTools} | R Documentation

## ID By Row Number or Sequence Along

### Description

Generate a sequence of integers the `length`/`ncol` of an object.

### Usage

    id(x, prefix = FALSE, pad = TRUE, ...)

### Arguments

`x` | A dataframe, matrix, vector, or list object.
`prefix` | A character string to use as a prefix. `FALSE` or `NULL` results in no prefix being used. `TRUE` will utilize the prefix `"X."`.
`pad` | logical. If `TRUE` the beginning number will be padded with zeros.
`...` | Other arguments passed to `pad`.

### Value

Returns a vector of sequential integers.

### Examples

    id(list(1, 4, 6))
    id(matrix(1:10, ncol=1))
    id(mtcars)
    id(mtcars, TRUE)
    id("w")
    id(mtcars, prefix="id-")
    ## Not run:
    library(qdap)
    question_type(DATA.SPLIT$state, id(DATA.SPLIT, TRUE))

    ## End(Not run)

[Package qdapTools version 1.3.3 Index]