saq_clean_observations: Function to clean and format observational data from...

Description Usage Arguments Value Author(s) Examples

View source: R/sairr_clean_observations.R

Description

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

Usage

1
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.

Author(s)

Stuart K. Grange

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 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()

saqgetr documentation built on Jan. 15, 2021, 2:57 p.m.