R/air_lead_and_scaling_functions.R
calculate_scaling_factors.Rd
calculate_scaling_factors()
constructs temporal scaling factors based on measurements
of airborne lead recorded by the EPA in the Cincinnati area. These scaling factors are
the average lead measured over the time period specified by start_date
and
end_date
, divided by the average lead recorded over the ambient air sampling period (2001 to 2005).
Scaling factors can be multiplied by air lead estimates from calculate_airPb()
to adjust for
temporal variability in airborne lead in the Cincinnati area over time.
calculate_scaling_factors(dates)
dates | A data.frame with 2 columns called 'start_date' and 'end_date' at minimum.
Both columns must be of class |
---|
A numeric vector of temporal scaling factors.
EPA data in this package is available from November 9, 2001 through November 28, 2018. Scaling factors that attempt to average over air lead measured on dates outside this range will not be calculated. In addition, it is important to be mindful of the frequency of air lead measurements recorded by the EPA. Note that air lead 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 air lead between the start_date and end_date, the scaling factor will not be calculated and NA will be returned.
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)