data.table
is very fast! However the syntax is much different. It is much like switching to ggplot from the standard base plot functions.
Code First:
library(data.table)
DT <- data.table(RF = 1:10,
S_1 = 11:20,
S_2 = 21:30,
addCol = rnorm(10))
bob<-as.data.frame(DT)
larry <- DT
set(DT, j = varnames, value = DT[, varnames, with = F]*DT[, RF])
Questions:
When I do run the above code, I only want to change the values in DT. However, the values in the object larry are also changed. If this is a feature, then I need help understanding how to use it. How do I stop the set command from changing both larry and DT at the same time?