edgelist_from_base: Compute the edgelist of a network from a database of...

Description Usage Arguments Details Value See Also

View source: R/NetworkBuilding.R

Description

This function computes the edgelist of a network of facilities across which subjects can be transferred. The edgelist is computed from a database that contains the records of the subjects' stays in the facilities.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
edgelist_from_base(
  base,
  window_threshold = 365,
  count_option = "successive",
  condition = "dates",
  noloops = TRUE,
  nmoves_threshold = NULL,
  flag_vars = NULL,
  flag_values = NULL,
  verbose = FALSE
)

Arguments

base

(data.table) A database of records of stays of subjects in facilities. The table should have at least the following columns:

  • subjectID (character) unique subject identifier

  • facilityID (character) unique facility identifier

  • admDate (POSIXct) date of admission in the facility

  • disDate (POSIXct) date of discharge of the facility

window_threshold

(integer) A number of days. If two stays of a subject at two facilities occurred within this window, this constitutes a connection between the two facilities (given that potential other conditions are met).

count_option

(character) How to count connections. Either "successive" or "all". See details.

condition

(character) Condition(s) used to decide what constitutes a connection. Can be "dates", "flags", or "both". See details.

noloops

(boolean). Should transfers within the same nodes (loops) be kept or set to 0. Defaults to TRUE, removing loops (setting matrix diagonal to 0).

nmoves_threshold

(numeric) A threshold for the minimum number of subject transfer between two facilities. Set to NULL to deactivate, default to NULL.

flag_vars

(list) Additional variables that can help flag a transfer, besides the dates of admission and discharge. Must be a named list of two character vectors which are the names of the columns that can flag a transfer: the column that can flag a potential origin, and the column that can flag a potential target. The list must be named with "origin" and "transfer". Eg: list("origin" = "var1", "target" = "var2"). See details.

flag_values

(list) A named list of two character vectors which contain the values of the variables in flag_var that are matched to flag a potential transfer. The list must be named with "origin" and "transfer". The character vectors might be of length greater than one. Eg: list("origin" = c("value1", "value2"), "target" = c("value2", "value2")). The values in 'origin' and 'target' are the values that flag a potential origin of a transfer, or a potential target, respectively. See details.

verbose

TRUE to print computation steps

Details

TODO

Value

A list of two data.tables, which are the edgelists. One in long format (el_long), and one aggregated by pair of nodes (el_aggr).

See Also

matrix_from_edgelist, matrix_from_base


PascalCrepey/HospitalNetwork documentation built on Sept. 16, 2020, 9:56 p.m.