Guest User

Untitled

a guest
Nov 24th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. week_difference <- function(end_date, start_date){
  2. as.integer(difftime(head(strptime(end_date, format = "%Y-%m-%d"), 1),
  3. tail(strptime(start_date, format = "%Y-%m-%d"),1), units = "weeks"),0)
  4. }
  5.  
  6.  
  7. retention_week <- funnel_workout %>% group_by(userId) %>% select(userId, cohortId) %>%
  8. 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