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.
Description
Generate a sequence of integers the
length
/ncol
of an object.
Examples
id(list(1, 4, 6))
[1] "1" "2" "3"
id(matrix(1:10, ncol=1))
[1] "01" "02" "03" "04" "05" "06" "07" "08" "09" "10"
id(mtcars)
[1] "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24"
[25] "25" "26" "27" "28" "29" "30" "31" "32"
id(mtcars, TRUE)
[1] "X.01" "X.02" "X.03" "X.04" "X.05" "X.06" "X.07" "X.08" "X.09" "X.10" "X.11" "X.12" "X.13" "X.14" "X.15" "X.16" "X.17"
[18] "X.18" "X.19" "X.20" "X.21" "X.22" "X.23" "X.24" "X.25" "X.26" "X.27" "X.28" "X.29" "X.30" "X.31" "X.32"
id("w")
[1] "1"
id(mtcars, prefix="id-")
[1] "id-01" "id-02" "id-03" "id-04" "id-05" "id-06" "id-07" "id-08" "id-09" "id-10" "id-11" "id-12" "id-13" "id-14" "id-15"
[16] "id-16" "id-17" "id-18" "id-19" "id-20" "id-21" "id-22" "id-23" "id-24" "id-25" "id-26" "id-27" "id-28" "id-29" "id-30"
[31] "id-31" "id-32"
## <strong>Not run</strong>:
# library(qdap)
# question_type(DATA.SPLIT$state, id(DATA.SPLIT, TRUE))
# ## <strong>End(Not run)</strong>