Hi,
Try:
evt_c.1- read.table(text=
patient_id responsed_at
1 2010-5
1 2010-7
1 2010-8
1 2010-9
2 2010-5
2 2010-6
2 2010-7
,sep=,header=TRUE,stringsAsFactors=FALSE)
lst1-split(evt_c.1,evt_c.1$patient_id)
Hi,
I hope this is what you are looking for:
library(plyr)
mutate(evt_c.1,t=ave(as.numeric(gsub(.*\\-,,responsed_at)),patient_id,gsub(-.*,,responsed_at),FUN=function(x)
c(0,cumsum(diff(x)
# patient_id responsed_at t
#1 1 2010-5 0
#2 1 2010-7 2
#3
Hi,
Try this:
library(mondate)
mutate(evt_c.1,t=ave(round(as.numeric(mondate(paste(evt_c.1[,2],-01,sep=,patient_id,FUN=function(x)
c(0,cumsum(diff(x)
# patient_id responsed_at t
#1 1 2010-5 0
#2 1 2010-7 2
#3 1 2010-8 3
#4 1
Hi.
No problem.
cc:ing to Rhelp.
A.K.
From: GUANGUAN LUO guanguan...@gmail.com
Sent: Wednesday, April 17, 2013 10:25 AM
Subject: Re: how to change the date into an interval of date?
Thank you so much . That is exactly the things i want.
GG
Hi,
Try
Hi,
Please check your dput().
By using your dput() output, I am getting:
$patient_id
[1] 2 2 2 2 3 3 3 3
$responsed_at
[1] 14755 14797 14835 14883 14755 14789 14826 14857
$number
[1] 1 2 3 4 1 2 3 4
$score
[1] 1 1 2 3 1 5 4 5
$.Names
[1] patient_id responsed_at number scores
Hi,
I am not sure I understand your question correctly.
dat1- read.table(text=
id responsed_at number_of_connection
scores
1 12-01-2010 1
2
1
6 matches
Mail list logo