clone_dt: Clone a data.table

View source: R/dt_ops.R

clone_dtR Documentation

Clone a data.table

Description

'clone_dt' clones a data.table and binds the copies at the bottom of the original data.table. It also creates an column named `.id` to identify each iteration. The keys of the input data.table are retained.

Usage

clone_dt(dtb, times, idcol = TRUE)

Arguments

dtb

A data.table to be cloned

times

The number of cloning iterations

idcol

= TRUE Creates a new column containing the id of each data.table iteration

Value

A data.table binding the original one and the new iterations with a column for the id of each iteration, invisibly

Examples

library(data.table)
library(CKutils)
x <- c(1, 5, 3, 6, 4, 2, 9, 8, 7)
dtb <- data.table(x)
clone_dtb(dtb, 3, idcol = TRUE)

ChristK/CKutils documentation built on April 11, 2025, 10:11 p.m.