0

I have list of intervals between events but I need to turn them into a list of timepoints of the same events. Is there a way of adding up values continuously from one column to the other ? Results should like a little something like the table below. Right now only column Interval exists.

Interval Timepoint
0.55 0.55
0.87 1.42
0.80 2.23
0.75 2.98
0.73 3.72
0.64 4.37
Slevin
  • 5
  • 2

1 Answers1

0

The cumsum() function does exactly this!

df = data.frame( interval = interval, time = cumsum(interval) )
Wesley
  • 1,324
  • 1
  • 11
  • 27