fetch_pt_associated_files: fetch_pt_associated_files - Project Tracker Reports

View source: R/fetch_pt_associated_files.R

fetch_pt_associated_filesR Documentation

fetch_pt_associated_files - Project Tracker Reports

Description

This function accesses the api endpoint for associated files that have been uploaded to project tracker. This api endpoint accepts a large number of filters associated with the project. Project specific filters include project code(s), years, lakes, and project lead. Use show_filters("associated_files") to see the full list of available filters. This function is used to download any files in the associated files section of project tracker to a specified target directory. It is often used in conjunction with get_pt_associated_files() which returns a dataframe containing attributes of the upload files.

Usage

fetch_pt_associated_files(
  filter_list,
  target_dir,
  xlsx_toc = TRUE,
  create_target_dir = TRUE
)

Arguments

filter_list

list - the filters used to select the projects and reports to be downloaded from the server.

target_dir

string - the directory where the files will be copied

xlsx_toc

the name of the excel table of contents file to be created in the target directory. A toc is only produced if this argument ends in 'xlsx'.

create_target_dir

boolean should the target directory be created if it does not already exist

Value

dataframe

Author(s)

Adam Cottrill adam.cottrill@ontario.ca

See Also

get_pt_associated_files()

Examples


reports <- fetch_pt_associated_files(
  list(
    lake = "ON", year__gte = 2012,
    year__lte = 2018
  ),
  target_dir = "~/Target Folder Name"
)

reports <- fetch_pt_associated_files(
  list(
    lake = "HU", year__gte = 2012,
    prj_cd__like = "006"
  ),
  target_dir = "~/Target Folder Name"
)

reports <- fetch_pt_associated_files(list(
  lake = "ER", protocol =
    "TWL"
), target_dir = "~/Target Folder Name")

filters <- list(lake = "SU", prj_cd = c("LSA_IA15_CIN", "LSA_IA17_CIN"))
reports <- fetch_pt_associated_files(filters,
  target_dir = "~/Target Folder Name"
)

reports <- fetch_pt_associated_files(list(
  lake = "HU", protocol =
    "USA"
), target_dir = "~/Target Folder Name")



AdamCottrill/glfishr documentation built on Aug. 9, 2024, 5:47 p.m.