A Getting started

The Air-Health SWS R targets pipeline requires R >= 4.0.0 and access to CARDAT’s Environment_General data storage folder on Cloudstor.

To run the Air Health SWS for the first time:

  1. Download and unzip or clone the air-health-sws-r-targets repository from the Code dropdown button.
  2. Load the R project. Open the _targets.R script.
    • Edit the global variables years and states to set the study coverage - note with the initial parameters in the pipeline, years is limited to 2010-2015.
    • Set the download_data boolean and dir_cardat to the correct path (parent directory of Environment_General).
  3. Open the main..R script. (This is not integral to the targets pipeline but is a place to keep all the useful commands for visualisiing, running and exploring the pipeline outside of the pipeline itself.) Begin running the script line-by-line from the top.
    • renv should automatically install and activate. Install the packages using renv::restore() or try the alternative custom installation function install_pkgs() (installs the latest version if library not already available). This step may take some time.
    • If you have set download_data <- FALSE in _targets.R, uncomment and run the lines at the top of the Run pipeline section to authenticate your cloudstoR package’s access to Cloudstor. You should not need to authenticate again unless your credentials have changed.
    • Continue on to visualise and run the pipeline.
  4. See the results of the desired target with tar_read(target_name).

_targets.R and the custom functions called by targets (stored in R/) can be modified and extended to control pipeline output.