Learn R Programming

saqgetr (version 0.2.21)

saq_clean_observations: Function to clean and format observational data from saqgetr's get_saq_observations function.

Description

Function to clean and format observational data from saqgetr's get_saq_observations function.

Usage

saq_clean_observations(df, summary = "hour", valid_only = TRUE, spread = FALSE)

Arguments

df

Tibble/data frame from get_saq_observations.

summary

Summary to filter data to. Default is "hour".

valid_only

Should only valid observations be kept?

spread

Should the data be "spread" where the data frame is reshaped so pollutants form variables/columns. This format is usually what is desired when using openair.

Value

Tibble.

Examples

Run this code
# NOT RUN {
# Load a site's data
data_hafodyrynys <- get_saq_observations(
  site = "gb1038a", 
  start = 2018, 
  end = 2018
)

# Keep only valid and hourly data
data_hafodyrynys_hourly <- data_hafodyrynys %>% 
  saq_clean_observations(summary = "hour", valid_only = TRUE) %>% 
  print()

# Spread hourly data, a different table format here
data_hafodyrynys_hourly_spread <- data_hafodyrynys %>% 
  saq_clean_observations(summary = "hour", valid_only = TRUE, spread = TRUE) %>% 
  print()

# }

Run the code above in your browser using DataLab