To assign multiple columns by reference in data.table, you can use the := operator and list the columns to be assigned as new values. Here's an example:
main.r380 chars22 lines
In the above example, we first created a data.table called dt and then used the := operator to assign new values to columns x and z by multiplying x by 2 and adding 1 to z. We did this all by reference, without creating a copy of the original data.table.
gistlibby LogSnag