Skip to content
Prev 313643 / 398513 Next

Hello R User

HI,
Try:
dat2[,Time1:=c(0,diff(Time)),by=ID]
dat2[,CumSTime1:=cumsum(Time1),by=ID]


? head(dat2,4)
#?? ID Time Time1 CumSTime1
#1:? 1??? 3???? 0???????? 0
#2:? 1??? 6???? 3???????? 3
#3:? 1??? 7???? 1???????? 4
#4:? 1?? 10???? 3???????? 7
A.K.

----- Original Message -----
From: bibek sharma <mbhpathak at gmail.com>
To: arun <smartpink111 at yahoo.com>
Cc: 
Sent: Friday, December 14, 2012 12:56 PM
Subject: Re: [R] Hello R User

Hi Arun,
Great!
Once we get, time1, I again wanna add time to its previous value for
example, wanna get 0,3 4 etc...
can I have suggestion?
On Fri, Dec 14, 2012 at 9:42 AM, arun <smartpink111 at yahoo.com> wrote:
Message-ID: <1355509601.85332.YahooMailNeo@web142602.mail.bf1.yahoo.com>
In-Reply-To: <CAGC2kj6SV+5ySGrkA5nQG+h-jffQ+XZOhJVEngEQYk3gd_mvGg@mail.gmail.com>