collapse icon indicating copy to clipboard operation
collapse copied to clipboard

Optimize class assignments

Open SebKrantz opened this issue 3 years ago • 0 comments

It turns out that calling replacement functions in base R entails a deep copy in some cases:

# No deep copy
f2 <- function(x) {
  oldClass(x) <- "dfd"
  x
}

# Deep copy
f3 <- function(x) `oldClass<-`(x, "dfd")

collapse still has unnecessary deep copies in some places.

SebKrantz avatar Aug 17 '22 11:08 SebKrantz