Open antalk2 opened 3 months ago
For a POSIXlt vector x0
x0
After x <- x0 vec_slice(x,1) <- another does not only change the value of x, it also changes the value of x0 . Is this expected?
x <- x0
vec_slice(x,1) <- another
x
library(vctrs) # `[<-` works as expected (clones x) x0_reference <- as.POSIXlt("2020-11-01") x0 <- as.POSIXlt("2020-11-01") another <- as.POSIXlt("9020-11-01") x <- x0 x[1] <- another identical(x0, x0_reference) # TRUE identical(x , x0 ) # FALSE # # `vec_slice<-` does not clone # x0_reference <- as.POSIXlt("2020-11-01") x0 <- as.POSIXlt("2020-11-01") another <- as.POSIXlt("9020-11-01") x <- x0 vec_is(x) # TRUE vec_slice(x,1) <- another # also changes x0 identical(x0, x0_reference) # FALSE identical(x , x0 ) # TRUE
For a POSIXlt vector
x0
After
x <- x0
vec_slice(x,1) <- another
does not only change the value of
x
,it also changes the value of
x0
. Is this expected?