0

I have a little problem...let's say I have a data.table with one numerical column like:

  NR
  1
  2
  3
  5
  7 
  10
  1

I want to create a new column which is computed in this way: in row j I want the sum of NR in the rows j, j+1, j+2. So I want this result:

  NR    NEW_NR
  1     6
  2     10
  3     15
  5     22
  7     18
  10    11
  1     1

Could anyone help me pls?

Bmb58
  • 155
  • 2
  • 9

0 Answers0