From a73e865906cb3997456114f9526633e575c6cbb8 Mon Sep 17 00:00:00 2001 From: Tyson Barrett Date: Sun, 7 Jan 2024 13:50:25 -0700 Subject: [PATCH] use data.table:::shallow instead of copy --- R/fill.R | 4 ++-- R/separate.R | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/fill.R b/R/fill.R index 69269e1..70f0631 100644 --- a/R/fill.R +++ b/R/fill.R @@ -40,7 +40,7 @@ dt_fill <- function(dt_, ..., id = NULL, .direction = c("down", "up", "downup", dt_fill.default <- function(dt_, ..., id = NULL, .direction = c("down", "up", "downup", "updown"), immutable=TRUE){ - if (isFALSE(is.data.table(dt_))){ + if (isFALSE(data.table::is.data.table(dt_))){ dt_ <- data.table::as.data.table(dt_) } @@ -56,7 +56,7 @@ dt_fill.default <- function(dt_, ..., id = NULL, .direction = c("down", "up", "d by <- substitute(id) if (immutable) - dt_ <- copy(dt_) + dt_ <- data.table:::shallow(dt_) dt_[, paste(dots) := lapply(.SD, fun), by = eval(by), .SDcols = dots][] } diff --git a/R/separate.R b/R/separate.R index 4f62661..9f00baa 100644 --- a/R/separate.R +++ b/R/separate.R @@ -63,7 +63,7 @@ dt_separate.default <- function(dt_, col, into, # checks and nse if (isFALSE(is.data.table(dt_))) dt_ <- data.table::as.data.table(dt_) - if (isTRUE(immutable)) dt_ <- data.table::copy(dt_) + if (isTRUE(immutable)) dt_ <- data.table:::shallow(dt_) if (dev) { j <- col } else {