I have a set of 10 years (2009-2020), 30-min interval meteorological datasets, but the data has missing values during night (~17:00 to ~08:00 next day) for 2 two years (2015-2017) due to battery failure of the instrument. Variables are: air temperature, humidity, wind, radiations.
- Does anyone have any good idea to fill those values? Or
- If I want to fill them using mean of each variable for same time step (rest of the years), how to do that? Any idea please?
I tried to do using fill_by_function(fun = mean) of padR, but it uses mean of all datasets and a single value.
Below I have put a slice example of my data frame structure:
chhota_1 <- data %>%
slice(89845:89900) %>%
pad() %>%
fill_by_value(na.pad=TRUE)
You could accomplish it via
data.table(among many other methods):fill
NAby mean for that timestep (over other years):EDIT:
From the sample data provided and comments: