I have a data frame with three columns, the first one is the id, the second one when an event A happend and a third column when the event B happened.
client <- rep(c("A","B","C"),5)
event_a <- c("2017-04-02","2017-04-07","2017-04-10", "2017-04-13","2017-04-
17","2017-04-18","2017-04-20","2017-04-22","2017-04-25","2017-04-27","2017-
04-30","2017-05-10","2017-05-12","2017-05-15","2017-05-20")
event_b <- c("2017-04-05",NA,"2017-04-11", "2017-04-14",NA,"2017-04-
20","2017-04-21",NA,"2017-04-30",NA,"2017-04-30",NA,NA,"2017-05-15",NA)
data <- data.frame(client, event_a, event_b)
I would like to know if the client makes the event A after the event B, or if event B is NA - a boolean variable or a count one. But I like to insert this column in the data.frame, to model in a second moment.
Thank you!