pad_to_year_fill | R Documentation |
This function pad data to complete years. The fill mechanism is:
find min- and max time
group data by columns provided by ...
or all factor/character columns
dplyr::group_nest()
pass the nested data for each group to pad_to_year()
with the min- and max time
tidyr::unnest()
pad_to_year_fill(data, date_col, interval, ...)
data |
input data |
date_col |
column containing time information |
interval |
interval between two dates. See |
... |
columns to fill up |
padded data
fn <- rOstluft.data::f("Zch_Stampfenbachstrasse_min30_2013_Jan.csv")
data <- rOstluft::read_airmo_csv(fn)
tail(data)
# fills up all factor and character columns
pad_to_year_fill(data, starttime, "30 min") %>% tail()
# or only the specific and the rest with na
pad_to_year_fill(data, starttime, "30 min", site) %>% tail()
# data in wide format
data <- rOstluft::rolf_to_openair(data)
pad_to_year_fill(data, date, "30 min") %>% tail()
# but be careful not to include cutting factors
data <- openair::cutData(data, "month") %>%
dplyr::select(month, dplyr::everything())
# fills up month and would multiply the data by the numbers of months
pad_to_year_fill(data, date, "30 min") %>% tail()
# only fills up the site column
pad_to_year_fill(data, date, "30 min", site) %>% tail()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.