hi:
I have a datatable with two columns (see below) and I want to create
another column that adds the values of the rows in the first two
columns. I am trying this:
DT[ , col3 :=rowSums(.SD, na.rm = TRUE), .SDcols = c(col1,col2)]
but I get this error:
Error in inherits(x, data.frame) :
On Thursday 30 May 2013 02:57:04 Camilo Mora wrote:
do you know why is this? or is there another way to sum by row in a
given number of columns?
Without data.table:
x - structure(list(col1 = c(NA, 0, -0.015038, 0.003817, -0.011407
), col2 = c(0.003745, 0.007463, -0.007407, -0.003731,
2 matches
Mail list logo