Skip to content
Discussion options

You must be logged in to vote

@manalkamal how about:

df %>%
  fmutate(yr_month = as.yearmon(yr_month)) %>%
  join(expand.grid(clinic = unique(.$clinic),
                   yr_month = seq(min(.$yr_month), max(.$yr_month), by = 1 / 12)),
       how = "full") %>%
  replace_na(0, cols = "rate") %>%
  roworder(clinic, yr_month)

By groups would be more difficult - need to change the expand.grid() accordingly.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@manalkamal
Comment options

@SebKrantz
Comment options

@manalkamal
Comment options

@SebKrantz
Comment options

Answer selected by manalkamal
@manalkamal
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants