From c610c14263c5ebc22a6ff5b4a9e51d06f0c7630f Mon Sep 17 00:00:00 2001 From: Cole Brokamp Date: Mon, 18 Mar 2024 21:21:07 -0400 Subject: [PATCH] try fewer years for vignette - sometimes stalls on gha when new years of NARR data are downloaded --- vignettes/case-crossover-example.Rmd | 5 ++--- vignettes/timeline-example.Rmd | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/vignettes/case-crossover-example.Rmd b/vignettes/case-crossover-example.Rmd index 1ca9278..73f9161 100644 --- a/vignettes/case-crossover-example.Rmd +++ b/vignettes/case-crossover-example.Rmd @@ -21,7 +21,7 @@ library(appc) library(dplyr, warn.conflicts = FALSE) ``` -This example details how to use the appc package to add air pollution exposure estimates for exact locations and dates defined by geocoded coordinates and a case date. For this example workflow, we will simulate 20 random locations in Wayne County, Michigan and case dates between 2019 and 2022, but in actuality this can be any set of geocoded `lat` and `lon` columns with corresponding dates. +This example details how to use the appc package to add air pollution exposure estimates for exact locations and dates defined by geocoded coordinates and a case date. For this example workflow, we will simulate 20 random locations in Wayne County, Michigan and case dates in 2022, but in actuality this can be any set of geocoded `lat` and `lon` columns with corresponding dates. ```{r} #| warnings: false @@ -34,7 +34,7 @@ d <- sf::st_coordinates() |> tibble::as_tibble() |> rename(lat = Y, lon = X) |> - mutate(case_date = sample(seq(as.Date("2019-01-01"), as.Date("2022-12-31"), by = 1), size = 20)) |> + mutate(case_date = sample(seq(as.Date("2022-01-01"), as.Date("2022-12-31"), by = 1), size = 20)) |> mutate(id = 1:20) |> relocate(id) @@ -75,7 +75,6 @@ Then we can directly use the `s2` and `dates` columns to add temperature and hum d <- d |> dplyr::mutate(temperature = get_narr_data(s2, dates, "air.2m"), humidity = get_narr_data(s2, dates, "rhum.2m")) - d <- d |> dplyr::mutate(pm25 = predict_pm25(s2, dates)) d diff --git a/vignettes/timeline-example.Rmd b/vignettes/timeline-example.Rmd index 429ee30..01a8015 100644 --- a/vignettes/timeline-example.Rmd +++ b/vignettes/timeline-example.Rmd @@ -48,18 +48,24 @@ d <- d |> rowwise() |> mutate(dates = list(seq(start_date, end_date, by = 1))) |> ungroup() + +d ``` Next, we will use the `lon` and `lat` columns to create the s2 geohash: ```{r} d <- d |> dplyr::mutate(s2 = s2::as_s2_cell(s2::s2_geog_point(lon, lat))) + +d ``` Directly use the `s2` and `dates` columns to call the `predict_pm25()` function: ```{r} d <- d |> dplyr::mutate(pm25 = predict_pm25(s2, dates)) + +d ``` With daily exposures, we could average fine particulate matter throughout the study period: