Understanding exactly when a data.table is a reference to (vs a copy of) another data.table

Yes, it’s subassignment in R using <- (or = or ->) that makes a copy of the whole object. You can trace that using tracemem(DT) and .Internal(inspect(DT)), as below. The data.table features := and set() assign by reference to whatever object they are passed. So if that object was previously copied (by a subassigning <- … Read more

How do you delete a column by name in data.table?

Any of the following will remove column foo from the data.table df3: # Method 1 (and preferred as it takes 0.00s even on a 20GB data.table) df3[,foo:=NULL] df3[, c(“foo”,”bar”):=NULL] # remove two columns myVar = “foo” df3[, (myVar):=NULL] # lookup myVar contents # Method 2a — A safe idiom for excluding (possibly multiple) # columns … Read more

data.table vs dplyr: can one do something well the other can’t or does poorly?

We need to cover at least these aspects to provide a comprehensive answer/comparison (in no particular order of importance): Speed, Memory usage, Syntax and Features. My intent is to cover each one of these as clearly as possible from data.table perspective. Note: unless explicitly mentioned otherwise, by referring to dplyr, we refer to dplyr’s data.frame … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)