plot.hosp_network: Plot a 'hosp_network' Object

View source: R/plot.hosp_network.R

plot.hosp_networkR Documentation

Plot a hosp_network Object

Description

Create a network graph of your patient location history data

Usage

## S3 method for class 'hosp_network'
plot(
  x,
  by = c("unit", "room"),
  type = c("simple", "hub score", "authority score"),
  ...
)

Arguments

x

An object of class hosp_network

by

Two options, either 'unit' or 'room', telling whether to graph by unit or room interconnectivity

type

Three options, either 'simple', 'hub score', or 'authority score', telling how the nodes should be sized. Simple graphs the nodes as all the same size, while the other two graph the nodes with sizes corresponding to their respective scores (see hub_score and authority_score).

...

Additional arguments to be passed to plot.igraph, such as vertex.color. The ones already set are listed in the details section.

Details

edge.arrow.size, edge.curved, vertex.label, vertex.label.cex, vertex.size, asp, layout, and main are the plot.igraph options already given by this function, so to do more customization, please choose other options.

Value

Returns NULL, invisibly, as plot.igraph is used to output the plot

Examples

hn_data <- hosp_network_data # read in example data provided in package

cleaned_hn_data <- clean_hosp_network(data = hn_data, uniqueID = UniqueEncountID, startDate = BeginDate, endDate = EndDate, unitName = UnitName, roomNum = RoomNumber) # clean the data using specific columns in the dataset

hn_object <- hosp_network(x = cleaned_hn_data, fromUnit = UnitName, toUnit = next_unit, fromRoom = RoomNumber, toRoom = next_room) # create an object of class hosp_network

plot(hn_object) # plot the hosp_network object using the unit data and type = simple, as those are the default options

plot(hn_object, by = "room", type = "hub score") # plot hosp_network object using room data and type = hub score

plot(hn_object, by = "unit", type = "authority score", vertex.color = "red") # plot hosp_network object using unit data, type = authority score, and vertex color = red

npeters1322/hospEpi documentation built on April 30, 2022, 6:12 p.m.