data.table Adding and modifying columns

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9


The official vignette, "Reference semantics", is the best introduction to this topic.

A reminder: DT[where, select|update|do, by] syntax is used to work with columns of a data.table.

  • The "where" part is the i argument
  • The "select|update|do" part is the j argument

These two arguments are usually passed by position instead of by name.

All modifications to columns can be done in j. Additionally, the set function is available for this use.

Got any data.table Question?