1

I am attempting to fill in the missing dates in my dataset using the pad function. If I use regular pad such as

data %>% pad(group = GROUP2)

then it works fine and keeps the column values such as brand, device, etc.

However, some of my data occurs at day intervals, some at week and some at month. Therefore, I want to use pad with do so that the time interval is determined individually for each group. When I run the below the whole row comes back as NA rather than keeping any of the column values like before.

library(dplyr)
library(padr)
padded_data <- data %>% 
  dplyr::group_by_at(GROUP2) %>% 
  do(pad(.))

I have tried to research around this but not found anything!

SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41
mfalcon
  • 11
  • 1
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Feb 06 '23 at 14:32
  • Please provide enough code so others can better understand or reproduce the problem. – Community Feb 06 '23 at 21:16
  • You cannot do this with `padr`, it takes only one interval value. The assumption is that all the groups share the same interval. If I were you I'd keep data on different intervals in different dataframes. Not just for `padr` but also for further analysis. – Edwin Jul 04 '23 at 11:24

0 Answers0