HospiNet | R Documentation |
Class providing the HospiNet object with its methods
Class providing the HospiNet object with its methods
R6Class
object.
Object of R6Class
with methods for accessing facility networks.
new(edgelist,
window_threshold,
nmoves_threshold,
noloops)
This method is used to create an object of this class with edgelist
as the necessary information to create the network.
The other arguments window_threshold
, nmoves_threshold
, and noloops
are specific to the edgelist
and need to be provided.
For ease of use, it is preferable to use the function hospinet_from_subject_database
print()
This method prints basic information about the object.
plot(type = "matrix")
This method plots the network matrix by default.
The argument type
can take the following values:
plot the network matrix,
identify and plot cluster(s) in the matrix using the infomap algorithm (from igraph),
plot the histogram of the number of neighbors by facility,
plot the network by clusters using a "spaghetti-like" layout. Only works when there are at least 2 clusters.
edgelist
(data.table) the list of edges (origin, target) and their associated number of movements (N) (read-only)
edgelist_long
(data.table) edgelist with additional information (read-only)
matrix
(matrix) the transfer matrix (active binding, read-only)
igraph
(igraph) the igraph object corresponding to the network (active binding, read-only)
n_facilities
the number of facilities in the network (read-only)
n_movements
the total number of subject movements in the network (read-only)
window_threshold
the window threshold used to compute the network (read-only)
nmoves_threshold
the nmoves threshold used to compute the network (read-only)
noloops
TRUE if loops have been removed (read-only)
hist_degrees
histogram data of the number of connections per facility
LOSPerHosp
the mean length of stay for each facility (read-only)
admissionsPerHosp
the number of admissions to each facility (read-only)
subjectsPerHosp
the number of unique subjects admitted to each facility (read-only)
degrees
number of connections for each facilities (total, in, and out)(read-only)
closenesss
the closeness centrality of each facility (read-only)
betweennesss
the betweenness centrality of each facility (read-only)
cluster_infomap
the assigned community for each facility, based on the infomap algorithm (read-only)
cluster_fast_greedy
the assigned community for each facility, based on the greedy modularity optimization algorithm (read-only)
hubs_global
Kleinberg's hub centrality scores, based on the entire network (read-only)
hubs_infomap
same as hubs_global, but computed per community based on the infomap algorithm (read-only)
hubs_fast_greedy
same as hubs_global, but computed per community based on the infomap algorithm (read-only)
metricsTable
(data.table) all of the above metrics for each facility (read-only)
new()
Create a new HospiNet object.
HospiNet$new( edgelist, edgelist_long, window_threshold, nmoves_threshold, noloops, prob_params, fsummary = NULL, create_MetricsTable = FALSE )
edgelist
Short format edgelist
edgelist_long
Long format edgelist
window_threshold
The window threshold used to compute the network
nmoves_threshold
The nmoves threshold used to compute the network
noloops
TRUE if loops have been removed
prob_params
Currently unused
fsummary
A pre-built data.table with the LOSPerHosp, subjectsPerHosp and admissionsPerHosp that don't need to be recomputed.
create_MetricsTable
all of the metrics for each facility
A new 'HospiNet' object
print()
Prints a basic description of the number of facilities and movements of a HospiNet object.
HospiNet$print()
NULL
plot()
Plots various representations of the HospiNet network
HospiNet$plot(type = "matrix", ...)
type
One of "matrix", "degree", "clustered_matrix", "circular network" Choose what you would like to plot - the connectivity matrix, degree distribution, the clusters, or the network in a circle.
...
Additional arguments to be provided. Only supported for ‘type == ’circular_network''.
a 'ggplot2' object
clone()
The objects of this class are cloneable with this method.
HospiNet$clone(deep = FALSE)
deep
Whether to make a deep clone.
mydbsmall <- create_fake_subjectDB(n_subjects = 100, n_facilities = 10) hn <- hospinet_from_subject_database( base = checkBase(mydbsmall), window_threshold = 10, count_option = "successive", condition = "dates" ) hn plot(hn) plot(hn, type = "clustered_matrix")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.