I have a dataframe with the European states where each state occurs 10 times (for 10 days). I want to interpolate the NA values of multiple columns, which I could achieve using
library("imputeTS")
na_interpolation(dataframe)
But I want to interpolate all NA values by state. How can that be done? I have already tried a lot of different solutions, but none did work for me.
As pseudo-code I would like to have something like
na_interpolation(dataframe, groupby=state)
Anything that could work?
These code samples did unfortunaetly not work for me
interpolation <- dataframe %>%
group_by(state-name) %>%
na_interpolation(dataframe)