My data looks as follows:
DF <- structure(list(No_Adjusted_Gross_Income = c(183454, 241199, 249506
), NoR_from_1_to_5000 = c(1035373, 4272260, 1124098), NoR_f
This should work.. lapply()
is not needed
library( data.table )
setDT( DF )
DF[, (var) := as.data.table ( t( t( DF[, 2:3] ) * val ) ) ][]
# No_Adjusted_Gross_Income NoR_from_1_to_5000 NoR_from_5000_to_10000 AGI_from_1_to_5000 AGI_from_5000_to_10000
# 1: 183454 1035373 319540 2588950187 2396550000
# 2: 241199 4272260 4826042 10682786130 36195315000
# 3: 249506 1124098 1959866 2810807049 14698995000