Learn R Programming

stranger (version 0.3.3)

add_id: Enrich source data with an ID

Description

add_id just ensures data is a data.table and adds a columns named .id

Usage

add_id(data)

Arguments

data

Source data (data.frame or data.table)

Value

data.table object with a column named .id

Details

add_id in called behing the scence by crazyfy if needed to ensure a valid id is present in source data. Still, we recommand to start from a dataset already having an id, be it generated by a call to add_id or already pre-existing to ensure correct source data enrichment.

Examples

Run this code
# NOT RUN {
library(stranger)
data(iris)
(iris.id <- add_id(iris))
# }

Run the code above in your browser using DataLab