Refer to columns by number in := assignment when using data.table
As per Row wise matrix operations in R I would like to apply a row-wise function on a data.table I have. I wish to calculate, per row, the mean of a number of columns in that row. My current attempt is:
This, unfortunately, simply returns the mean of the 'columns' vector rather than mean of the columns to which they refer. Is there a way to refer to these columns by number?
Here's the average I'm trying to achieve: