Data is like:
quarter name week value
17Q3 abc 1 0.7
17Q3 abc 3 0.65
17Q3 def 1 0.13
17Q3 def 2 0.04
Can I insert rows with value=0 where there is missing values for week i.e the output should be like:
quarter name week value
17Q3 abc 1 0.7
17Q3 abc 3 0.65
17Q3 abc 2 0.0
17Q3 def 1 0.13
17Q3 def 2 0.04
17Q3 def 3 0.0
need to fill till week 13.(i.e check till 13)
library(dplyr);df1 %>% complete(quarter, name, week = full_seq(week, 1), fill = list(value = 0)) %>% arrange(quarter, name, id) %>% mutate(id = row_number()) %>% select(names(df1))completeis fromtidyrsorry