The actual implementation of the fill method in the tidyr package (V0.8.3) doesn't perform very well if the dataset was grouped with the group_by() method.
This is a known issue and should be resolved in the next package version (see link below).
To decrease the required calculation time for now you could replace the fill method as follows:
Instead of
fill(df, columns, .direction = "up")
you can use
mutate(df, x = na.locf(x, na.rm=F, fromLast = T))
where
df ... data frame to manipulate
x ... column to fill up
fromLast ... defines filling direction (T = up, F = down)
The applied method "na.locf" is part of the zoo package. So don't forget to load this package with
library(zoo)
at the top of the script.
For further information on this topic see:
https://github.com/tidyverse/tidyr/issues/520