datadrop_get: Retrieve datasets from specified DoH Data Drop folders

Description Usage Arguments Value Examples

View source: R/get_data.R

Description

A wrapper to googledrive functions to retrieve datasets from the DoH Data Drop folders.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
datadrop_get(
  tbl,
  fn,
  path = NULL,
  keep = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

datadrop_get_changelog(
  tbl,
  path = NULL,
  keep = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

datadrop_get_sheets(
  tbl,
  path = NULL,
  keep = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

datadrop_get_fields(
  tbl,
  path = NULL,
  keep = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

datadrop_get_cases(
  tbl,
  path = NULL,
  keep = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

datadrop_get_tests(
  tbl,
  path = NULL,
  keep = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

datadrop_get_cdaily(
  tbl,
  path = NULL,
  keep = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

datadrop_get_cweekly(
  tbl,
  path = NULL,
  keep = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

datadrop_get_qdaily(
  tbl,
  path = NULL,
  keep = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

datadrop_get_qweekly(
  tbl,
  path = NULL,
  keep = FALSE,
  overwrite = FALSE,
  verbose = TRUE
)

Arguments

tbl

A tibble output produced by datadrop_ls() that lists the files within a particular DoH Data Drop Google Drive folder

fn

A character string composed of a word or words that can be used to match to the name of a file within a particular DoH Data Drop Google Drive folder listed in tbl.

path

A character value for path for output file. If NULL, the default file name used in Google Drive is used and the default location is the working directory.

keep

Logical. Should file be saved locally? Default to FALSE. If TRUE, file is kept in the location specified in path. If path is NULL, the file is kept in the working directory using the default file name used in Google Drive.

overwrite

Logical. If path already exists, should it be overwritten? Default to FALSE.

verbose

Logical. Should operation progress messages be shown? Default to TRUE.

Value

A tibble of any of the following datasets:

  1. Metadata - Sheets;

  2. Metadata - Fields;

  3. Case Information;

  4. DOH Data Collect - Daily Report;

  5. DOH Data Collect - Weekly Report;

  6. Testing Aggregates;

  7. Quarantine Facility Data - Daily Report;

  8. Quarantine Facility Data - Weekly Report;

  9. DOH Data Collect v3 - Baseline;

  10. DOH Data Collect v4 - Baseline; and,

  11. DDC TTMF Tracker v1. For Changelog, a named list of two tibbles - List of Changes and Most Common Changes. If keep is TRUE, a copy of the specified DoH Data Drop Google Drive file is saved in the location specified by path.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
## Not run: 
  library(googledrive)

  ## Authentication
  googledrive::drive_auth_configure(api_key = Sys.getenv("GOOGLEDRIVE_TOKEN"))

  ## Deauthorise
  googledrive::drive_deauth()

  ## Get tbl for files in latest Data Drop
  library(magrittr)
  x <- datadrop_id() %>% datadrop_ls()

  ## Retrieve case information data
  datadrop_get(tbl = x, fn = "Case Information", path = tempfile())

  ## Retrieve latest changelog information
  datadrop_get_changelog(tbl = x, path = tempfile())

  ## Retrieve latest metadata - sheets information
  datadrop_get_sheets(tbl = x, path = tempfile())

  ## Retrieve latest metadata - fields information
  datadrop_get_fields(tbl = x, path = tempfile())

  ## Retrieve latest cases information (same results as first example)
  datadrop_get_cases(tbl = x, path = tempfile())

  ## Retrieve latest daily hospital beds and mechanical ventilators information
  datadrop_get_cdaily(tbl = x, path = tempfile())

  ## Retrieve latest weekly PPE and other related equipment information
  datadrop_get_cweekly(tbl = x, path = tempfile())

  ## Retrieve latest testing aggregates information
  datadrop_get_tests(tbl = x, path = tempfile())

  ## Retrieve latest daily quarantine facility beds and mechanical ventilators
  datadrop_get_qdaily(tbl = x, path = tempfile())

  ## Retrieve latest weekly quarantine facility PPE and other related equipment
  datadrop_get_qweekly(tbl = x, path = tempfile())

## End(Not run)

#datadrop_get_collectV3(tbl = x, path = tempfile())
#datadrop_get_collectV4(tbl = x, path = tempfile())
#datadrop_get_tracker(tbl = x, path = tempfile())

como-ph/covidphdata documentation built on Dec. 31, 2020, 10:06 p.m.