From 1faa87328e30bc2bced0edcf30c2adf332ee8ea0 Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Sat, 24 Feb 2024 10:32:02 -0800 Subject: [PATCH] fix: mutable dt alias from unique.data.table #5932 Thanks to @brookslogan for the original bug report. --- R/duplicated.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/duplicated.R b/R/duplicated.R index 901d6e3c0..7fc7124a7 100644 --- a/R/duplicated.R +++ b/R/duplicated.R @@ -28,7 +28,7 @@ unique.data.table = function(x, incomparables=FALSE, fromLast=FALSE, by=seq_alon if (!isFALSE(incomparables)) { .NotYetUsed("incomparables != FALSE") } - if (nrow(x) <= 1L) return(x) + if (nrow(x) <= 1L) return(copy(x)) if (!length(by)) by = NULL #4594 o = forderv(x, by=by, sort=FALSE, retGrp=TRUE) if (!is.null(cols)) {