add_id: Add a Custom ID Column to Data Frame

Description Usage Arguments Note Examples

View source: R/AddID.r

Description

add_id adds a sequestional ID column with a custom prefix.

Usage

1
add_id(data, prefix, pad_number = 10, name = "ID")

Arguments

data

data.frame or data.table

prefix

Chacter string that appears befoer the number

pad_number

Integer indicating the total digits (not inlcluding prefix)

name

Character string for name of the variable

Note

For data.table load package dtplyr

Examples

1
2
3
4
5
foo <- data.frame(a = c(1:10), b = c(a:z))
foo <- AddID(foo, "test")

foo2 <- data.frame(a = c(1:10), b = c(a:z))
foo2 <- AddID(foo2, "PRE", pad_number = 3, name = "Tag")

MattKelliher-Gibson/prepr documentation built on March 21, 2020, 3:16 p.m.