I have a large dataframe which is taking me away from my comfort tidyverse
tools. I have one column in my data frame that I need to multiply the others by. How would I do this with data.table
?
For example I have the following toy data:
multiplier a1 a2
1 1 2
2 1 2
3 1 2
And the desired result
multiplier a1 a2
1 1 2
2 2 4
3 3 6
I dplyr
I would gather
the a
s then multiply, then finally spread
, but I am getting memory issues. How would I multiply the muliplier
column by each row in data.table