Displaying 1 result from an estimated 1 matches for "rcat".
Did you mean:
cat
2011 Jul 27
1
create a index.date column
...t tells me the first day of use of a category by
id.
#Calculate
time difference
test$tdiff<-as.numeric(difftime(as.Date("2002-09-01"), test$ftime, units = "days"))
#
obtain the index date per person and dcategory
index.date.test<-tapply(test$tdiff,
list(test$id, test$rcat), max)
Nonetheless,
at the moment I think will be more useful to create a column in my
data that tells me which row is the index date.
Something
like:
ti<-function(x){
ifelse(x==max(x),
"i", "n") # x = test$tdiff
}
tapply(test$tdiff,
list(test$rcat, test$id), F...