sitrep_file: Sitrep file

Description Usage Arguments Details Value Author(s)

View source: R/read-sitrep.R

Description

Convenience function to point to the correct location of sitrep files on the E drive.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sitrep_file(
  view = .views_avbl(),
  previous = FALSE,
  latest = FALSE,
  data_source = NULL,
  request_time = Sys.time(),
  fst = FALSE,
  must_exist = !fst,
  exact = FALSE
)

Arguments

view

One of the (given) strings, which file to read. The argument is called 'view' reflecting the SQL notion of a View.

view may also be a literal filename, in which case it is returned immediately and other arguments will be ignored, silently.

Partial matches are accepted, and if multiple matches are plausible then the best is chosen, with a message.

previous, latest

(TRUE or FALSE, default: FALSE) Should the previous/latest day's file be returned?

data_source

Which data to use? One of "today", "previous", "latest", or "hour".

By default, the values of previous,latest are used. If data_source is not NULL it takes priority.

request_time

(POSIXct(1)) The time requested, for the purposes of identifying and invalidating existing caches.

fst

(TRUE or FALSE, default: FALSE) Should the .fst version be returned. If FALSE, the default, the path returned is the standard .txt delimited/flat file.

must_exist

(TRUE or FALSE, default: negation of fst) If TRUE, but the requested file does not exist, an error is raised. Otherwise, the putative file location is returned.

exact

FALSE | TRUE If TRUE, then view must match exactly, (up to file extensions).

Details

The following columns (if present) are modified in the following way:

*Date

Any columns with 'Date' in their name will be coerced to Date class.

Classification

Missing values are coalesced to dhhs:::CLASSIFICIATION_MISSING_VALUE_ALIAS().

AgeGroupTenYr

Missing values are coalesced to dhhs:::AGEGROUP_MISSING_VALUE_ALIAS() and "00-09" is mapped to "0-9".

Latitude,Longitude

Any rows where Latitude > 90 are assumed to be rows where the latitude and longitude are confused/entered the wrong way and are switched back. Values of -999 are set to NA_real_.

Value

A string, the path to the file requested.

A data.table, the file requested.

Author(s)

Hugh Parsonage


HughParsonage/dhhs documentation built on Dec. 17, 2021, 11:22 p.m.