I'm running a loop in which two numeric columns are created based on some data. These two column names are generated by the part of the loop they are in. So for example, the first two columns are df$loop1.1 and df$loop1.2 and then in the following loop they'd be df$loop2.1 and df$loop2.2
I need to create a third column that is based off of those two columns like so:
df[, divisioncol := loop1.1 / loop1.2]
However, I'm getting the error
non-numeric argument to binary operator
Any suggestions?
Solved:
df[, divisioncol := get(loop1.1)/get(loop2.2)]