calculate_scaling_factors: Calculate temporal scaling factors based on EPA measurements...

Description Usage Arguments Details Value Examples

View source: R/ecat_and_scaling_functions.R

Description

calculate_scaling_factors() constructs temporal scaling factors based on measurements of elemental carbon (EC) recorded by the EPA in the Cincinnati area. These scaling factors are the average EC measured over the provided number of days_prior up to the provided dates, divided by the average EC recorded over the ECAT ambient air sampling period (2001 to 2005). Scaling factors can be multiplied by ECAT estimates from calculate_ecat() to adjust for temporal variability in ECAT in the Cincinnati area over time.

Usage

1

Arguments

dates

A data.frame with 2 columns called 'start_date' and 'end_date' at minimum. Both columns must be of class Date. See as.Date for help converting a character vector to a Date vector.

Details

EPA data in this package is available from November 9, 2001 through May 30, 2019. Scaling factors that attempt to average over EC measured on dates outside this range will not be calculated. In addition, it is important to be mindful of the frequency of EC measurements recorded by the EPA. Note that EC was measured every 6 days through the end of 2010, and every 3 days starting in 2011. If there are less than 4 measurements of EC between the start_date and end_date, the scaling factor will not be calculated and NA will be returned.

Value

A numeric vector of temporal scaling factors.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
my_dates <- data.frame(start_date = c("2010-01-08", "2012-06-08", "2010-01-09",
                                      "2015-04-09", "2010-01-10"),
                       end_date = c("2010-02-08", "2012-07-08", "2010-02-09",
                                    "2015-05-09", "2010-02-10"))

if (FALSE) {
class(my_dates$start_date)  # character vector
scaling1m <- calculate_scaling_factors(my_dates)
}

my_dates$start_date <- as.Date(my_dates$start_date)
my_dates$end_date <- as.Date(my_dates$end_date)
scaling1m <- calculate_scaling_factors(my_dates)

geomarker-io/ecat documentation built on May 15, 2020, 5:58 p.m.