hosp_network: Helper Function to Create an Object of Class 'hosp_network'

View source: R/hosp_network.R

hosp_networkR Documentation

Helper Function to Create an Object of Class hosp_network

Description

Creates an object of class hosp_network with the data and columns provided, allowing functions for hosp_network objects to be used

Usage

hosp_network(x, fromUnit = NULL, toUnit = NULL, fromRoom = NULL, toRoom = NULL)

Arguments

x

A data.frame containing the patient location history data

fromUnit

Optional, unquoted column name from x containing the from unit data

toUnit

Optional, unquoted column name from x containing the to unit data

fromRoom

Optional, unquoted column name from x containing the from room data

toRoom

Optional, unquoted column name from x containing the to room data

Value

An object of class hosp_network and data.frame

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

hn_object2 <- hosp_network(x = cleaned_hn_data, fromUnit = UnitName, toUnit = next_unit) # create an object of class hosp_network, but only with unit data

## Not run: 

hn_object3 <- hosp_network(x = cleaned_hn_data, fromUnit = UnitName, toUnit = next_unit, fromRoom = RoomNumber) # will throw an error because the next room is not given, but the original room is


## End(Not run)

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