sapply mult column and dataframe
Solution 1:
You need to reassign back into the corresponding columns.
ffq116[c(6:num_col)] <- sapply(ffq116[c(6:num_col)], function(i) i * ffq116$tot_wt)
I recognize this overwrites your version of ffq116
, you may prefer to first copy it with ffq2 <- ffq116
and then operate on that frame instead.