I am creating a copy of an object, and then when I manipulate the copy, also the original is changed. Is anyone familiar with this?
Reproducible example -
a <- data.table(av = c(1, 2, 3, 4, 5), bv = rnorm(5))
b <- a
b[, av:=factor(av)]
str(a) # av is a factor...
R version 4.2.0
data.table 1.14.2