New columns can be created in data.table using the := notation, as shown:
dstate[,IncomeGreaterThan5000:=Income>5000] # We will add a column IncomeGreaterThan5000 in-place using := # Adding multiple columns dstate[,c("IncomeGreaterThan5000","AreaLessThan5000"):=list(Income>5000,Area<5000)] # We will add a column IncomeGreaterThan5000 in-place using := # alternatively, we can also use `:=` dstate[,`:=`(IncomeGreaterThan5000=Income>5000,AreaLessThan5000=Area<5000)] # We will add a column IncomeGreaterThan5000 in-place using :=