Using do(pad(.)) in R and keeping all column names

36 Views Asked by At

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!

0

There are 0 best solutions below