Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- week_difference <- function(end_date, start_date){
- as.integer(difftime(head(strptime(end_date, format = "%Y-%m-%d"), 1),
- tail(strptime(start_date, format = "%Y-%m-%d"),1), units = "weeks"),0)
- }
- retention_week <- funnel_workout %>% group_by(userId) %>% select(userId, cohortId) %>%
- mutate(week_number = if(!is.na(cohortId)){week_difference(funnel_registration$cohortId, funnel_workout$cohortId)}else{print(NA)})
Add Comment
Please, Sign In to add comment