<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HospitalNetwork-Workflow • HospitalNetwork</title>
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><meta property="og:title" content="HospitalNetwork-Workflow">
<meta property="og:description" content="HospitalNetwork">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#toc">
    

    <div class="container template-article">
      <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
        <a class="navbar-link" href="../index.html">HospitalNetwork</a>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">0.9.3</span>
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
<li>
  <a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    Articles
     
    <span class="caret"></span>
  </a>
  <ul class="dropdown-menu" role="menu">
<li>
      <a href="../articles/HospitalNetwork-Workflow.html">HospitalNetwork-Workflow</a>
    </li>
  </ul>
</li>
<li>
  <a href="../news/index.html">Changelog</a>
</li>
      </ul>
<ul class="nav navbar-nav navbar-right">
<li>
  <a href="https://github.com/PascalCrepey/HospitalNetwork/" class="external-link">
    <span class="fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul>
</div>
<!--/.nav-collapse -->
  </div>
<!--/.container -->
</div>
<!--/.navbar -->

      

      </header><div class="row">
  <div class="col-md-9 contents">
    <div class="page-header toc-ignore">
      <h1 data-toc-skip>HospitalNetwork-Workflow</h1>
            
      
      <small class="dont-index">Source: <a href="https://github.com/PascalCrepey/HospitalNetwork/blob/HEAD/vignettes/HospitalNetwork-Workflow.Rmd" class="external-link"><code>vignettes/HospitalNetwork-Workflow.Rmd</code></a></small>
      <div class="hidden name"><code>HospitalNetwork-Workflow.Rmd</code></div>

    </div>

    
    
<div class="section level2">
<h2 id="context">Context<a class="anchor" aria-label="anchor" href="#context"></a>
</h2>
<p>This R package contains functions to help interested researchers
construct networks from data on movement of individual between
locations. Although this package was initially developed in the context
of networks of healthcare facilities, where the links represent transfer
of subjects between facilities, the process can be generalized to the
movement of any type of subject between any type of locations.</p>
<p>Formally, a network is composed of <em>nodes</em> which may or may
not be connected by <em>edges</em> (or links). In the context of this
package, the nodes are the facilities, and the links represent
connections between facilities. Although the definition of a node is
straightforward, one can define a <em>connection</em> between two
facilities in different ways. This package allows to construct a network
using various definition of a connection, which are discussed in detail
here [ref].</p>
<p>In terms of data structure, a common way of representing a network is
with a simple <span class="math inline">\(n*n\)</span> matrix (often
called adjacency matrix, or contact matrix). The rows and columns
contain the nodes (which appear once in each), and each cell contains
the information on whether or not the two nodes are connected.</p>
<table style="width:56%;" class="table">
<caption>Example of a matrix representation of a 5-nodes network. By
convention, the rows contain the facilities of origin, and the columns
contain the target facilities. Each cell contains the number of subjects
transfered.</caption>
<colgroup>
<col width="12%">
<col width="8%">
<col width="8%">
<col width="9%">
<col width="8%">
<col width="8%">
</colgroup>
<thead><tr class="header">
<th align="center"> </th>
<th align="center">A</th>
<th align="center">B</th>
<th align="center">C</th>
<th align="center">D</th>
<th align="center">E</th>
</tr></thead>
<tbody>
<tr class="odd">
<td align="center"><strong>A</strong></td>
<td align="center">0</td>
<td align="center">687</td>
<td align="center">373</td>
<td align="center">296</td>
<td align="center">0</td>
</tr>
<tr class="even">
<td align="center"><strong>B</strong></td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">1294</td>
<td align="center">263</td>
<td align="center">598</td>
</tr>
<tr class="odd">
<td align="center"><strong>C</strong></td>
<td align="center">602</td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">0</td>
</tr>
<tr class="even">
<td align="center"><strong>D</strong></td>
<td align="center">0</td>
<td align="center">0</td>
<td align="center">718</td>
<td align="center">0</td>
<td align="center">0</td>
</tr>
<tr class="odd">
<td align="center"><strong>E</strong></td>
<td align="center">339</td>
<td align="center">0</td>
<td align="center">86</td>
<td align="center">35</td>
<td align="center">0</td>
</tr>
</tbody>
</table>
<p>At its core, the purpose of this package is to compute the contact
matrix from raw data on movement between facilities. Additionally, this
package provides the researcher with various tools to analyze and
visualize the constructed network.</p>
</div>
<div class="section level2">
<h2 id="data">Data<a class="anchor" aria-label="anchor" href="#data"></a>
</h2>
<p>The package requires a minimal set of information in order to build a
network of facilities. This set of data is describe under the section
“Required data”. To proceed to further analysis, the package can use
additional information in case they are available. These informations
are listed under the section “Optional informations”.</p>
<div class="section level3">
<h3 id="required-data">Required data<a class="anchor" aria-label="anchor" href="#required-data"></a>
</h3>
<p>The minimal data needed to construct the network is a simple table
with four variables:</p>
<ul>
<li>
<strong>subject ID:</strong> an identifier unique to each
subject</li>
<li>
<strong>facility ID:</strong> an identifier unique to each
facility</li>
<li>
<strong>admission date:</strong> the date of admission of the
subject in the facility</li>
<li>
<strong>discharge date:</strong> the date of discharge of the
subject from the facility</li>
</ul>
<p>Therefore, each row must correspond to a unique stay of a subject in
a facility. Stays are not allowed to overlap (see <a href="#datamanagement">Data management</a>).</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://pascalcrepey.github.io/HospitalNetwork/" class="external-link">HospitalNetwork</a></span><span class="op">)</span></span>
<span><span class="co">#&gt; Loading required package: data.table</span></span>
<span><span class="va">data</span> <span class="op">=</span> <span class="fu"><a href="../reference/create_fake_subjectDB.html">create_fake_subjectDB</a></span><span class="op">(</span>n_subjects <span class="op">=</span> <span class="fl">3</span>, n_facilities <span class="op">=</span> <span class="fl">3</span><span class="op">)</span></span>
<span><span class="va">data</span></span>
<span><span class="co">#&gt;    sID fID      Adate      Ddate</span></span>
<span><span class="co">#&gt; 1:  s1  f2 2019-01-20 2019-01-24</span></span>
<span><span class="co">#&gt; 2:  s1  f3 2019-02-27 2019-03-04</span></span>
<span><span class="co">#&gt; 3:  s1  f2 2019-03-27 2019-03-28</span></span>
<span><span class="co">#&gt; 4:  s2  f2 2019-02-11 2019-02-12</span></span>
<span><span class="co">#&gt; 5:  s2  f3 2019-03-12 2019-03-15</span></span>
<span><span class="co">#&gt; 6:  s2  f3 2019-04-18 2019-04-19</span></span>
<span><span class="co">#&gt; 7:  s3  f3 2019-02-08 2019-02-14</span></span></code></pre></div>
</div>
<div class="section level3">
<h3 id="optional-data-in-the-same-database">Optional data (in the same database)<a class="anchor" aria-label="anchor" href="#optional-data-in-the-same-database"></a>
</h3>
<p>TODO</p>
<table class="table">
<colgroup>
<col width="23%">
<col width="30%">
<col width="46%">
</colgroup>
<thead><tr class="header">
<th>Item</th>
<th align="center">Variable name</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>Mode of entry</td>
<td align="center">entry</td>
<td>a variable indicating whether the subject arrived from home (0), or
from a facility (1)</td>
</tr>
<tr class="even">
<td>Mode of discharge</td>
<td align="center">discharge</td>
<td>a variable indicating whether the subject is discharged back home
(0), or to a facility (1)</td>
</tr>
<tr class="odd">
<td>Subject residential postcode</td>
<td align="center">postcode </td>
<td>a variable indicating the postal code of the subject residency</td>
</tr>
<tr class="even">
<td>Wards visited by the subject</td>
<td align="center">ward</td>
<td>a single type of ward predominantly visited by the subject, coded as
1 for ICU or acute care and 0 for others</td>
</tr>
</tbody>
</table>
</div>
<div class="section level3">
<h3 id="optional-data-in-a-separate-database">Optional data (in a separate database)<a class="anchor" aria-label="anchor" href="#optional-data-in-a-separate-database"></a>
</h3>
<p>TODO</p>
<table class="table">
<colgroup>
<col width="13%">
<col width="50%">
<col width="36%">
</colgroup>
<thead><tr class="header">
<th>Item</th>
<th align="center">Variable name</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>Facility localization</td>
<td align="center">localization</td>
<td>GPS coordinates of the facility</td>
</tr>
<tr class="even">
<td>Facility capacity</td>
<td align="center">capacity</td>
<td>the number of beds available in the facility</td>
</tr>
<tr class="odd">
<td>Facility type</td>
<td align="center">type</td>
<td>the type of facility (ECDC level definitions)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section level2">
<h2 id="workflow">Workflow<a class="anchor" aria-label="anchor" href="#workflow"></a>
</h2>
<p>The main function of the package is
<code><a href="../reference/hospinet_from_subject_database.html">hospinet_from_subject_database()</a></code>, which takes the database
as argument. It will first performs various diagnostic tests by calling
the function <code><a href="../reference/checkBase.html">checkBase()</a></code>, to check for possible issues, and
to ensure that the data is formatted correctly.</p>
<p>If the tests are successful,
<code><a href="../reference/hospinet_from_subject_database.html">hospinet_from_subject_database()</a></code> will proceed with several
operations and function calls to construct the network. The return value
is an <code>HospiNet</code> R6 object that contains the network itself,
as well as different metrics and information on the network.</p>
<div class="section level3">
<h3 id="diag">Diagnostic tests<a class="anchor" aria-label="anchor" href="#diag"></a>
</h3>
<p>The diagnostic tests on the database are performed by the function
<code><a href="../reference/checkBase.html">checkBase()</a></code>.</p>
<p>The function will check for possible errors in the database. It also
offer the possibility to automatically correct the issues it may have
found in the database. However, since we cannot guarantee having checked
for every possible issue, we encourage you to ensure the data is in the
correct format, and is free of errors, prior to run the function. By
default, <code><a href="../reference/checkBase.html">checkBase()</a></code> will not modify the database, but
return informative messages on the issues found. If you wish the
function to try to autocorrect the database, you must set the
corresponding arguments (see <a href="#datamanagement">Data
management</a>). We recommend that you carefully check the result
afterwards.</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Example</span></span>
<span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://pascalcrepey.github.io/HospitalNetwork/" class="external-link">HospitalNetwork</a></span><span class="op">)</span></span>
<span><span class="va">base</span> <span class="op">=</span> <span class="fu"><a href="../reference/create_fake_subjectDB.html">create_fake_subjectDB</a></span><span class="op">(</span>n_subjects <span class="op">=</span> <span class="fl">100</span>, n_facilities <span class="op">=</span> <span class="fl">10</span>, with_errors <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span>
<span><span class="fu"><a href="../reference/checkBase.html">checkBase</a></span><span class="op">(</span><span class="va">base</span><span class="op">)</span></span>
<span><span class="co">#&gt; Error in checkBase(base): Column(s) sID, fID, Adate, Ddate provided as argument were not found in the database.</span></span></code></pre></div>
<div class="section level4">
<h4 id="requirements">Requirements<a class="anchor" aria-label="anchor" href="#requirements"></a>
</h4>
<p>The requirements to pass the diagnostic tests are the following:</p>
<ul>
<li><p>the database must be of class <code>data.frame</code> or
<code>data.table</code>. The functions are implemented in the
<code>data.table</code> framework, so if a <code>data.frame</code> is
provided, it will be converted to a <code>data.table</code>.</p></li>
<li><p>the database must have at least four columns. By default the
column names must be: <code>c("sID", "fID", "Adate", "Ddate"</code>.
Although we recommend using these column names, it is possible to use
different names by providing them as arguments.</p></li>
<li><p>columns <code>"sID"</code> and <code>"fID"</code> must be of type
<code>character</code>.</p></li>
<li><p>dates are handled using functions from the <code>lubridate</code>
package. They should be <code>POSIXct date-time objects</code>.
Alternatively, they can be provided as character strings. In that case,
you can use <code><a href="../reference/checkBase.html">checkBase()</a></code> to try to parse them to date-time
objects using <code>lubridate</code> functions (see <a href="#datamanagement">Data management</a>).</p></li>
<li><p>stays should not overlap (see <a href="#datamanagement">Data
management</a> for more details).</p></li>
</ul>
</div>
<div class="section level4">
<h4 id="datamanagement">Data management<a class="anchor" aria-label="anchor" href="#datamanagement"></a>
</h4>
<p>The diagnostic functions of <code><a href="../reference/checkBase.html">checkBase()</a></code> will check for
the following issues:</p>
<ul>
<li><p>missing values: the following values will be flagged as missing:
actual missing values of the form <code>NA</code> or <code>NaN</code>,
character strings
<code>"NA", "na", "Na", "N/A", "n/a", "N/a", "NaN")</code>, and empty
character strings or empty quotes <code>"", "''"</code>.</p></li>
<li><p>discharge date of a stay anterior to its admission date.</p></li>
<li><p>overlapping stays: <strong>TODO</strong></p></li>
</ul>
<p>You can use the function <code><a href="../reference/checkBase.html">checkBase()</a></code> to try to correct
automatically the issues it has found by setting the corresponding
arguments.</p>
<ul>
<li><p>missing values: to remove entries with missing values, set the
argument <code>deleteMissing</code>. If set to <code>"record"</code>,
the record with the missing value will be removed. If set to
<code>"subject"</code>, all records of the same subject will be
removed.</p></li>
<li><p>errors: to remove errors, such as discharge date of a stay
anterior to admission date, set the argument <code>deleteErrors</code>.
If set to <code>"record"</code>, the record with the error will be
removed. If set to <code>"subject"</code>, all records of the same
subject will be removed.</p></li>
<li><p>overlapping stays: <code><a href="../reference/checkBase.html">checkBase()</a></code> will automatically
handle overlapping stays as follows: <strong>TODO</strong></p></li>
<li><p>dates: if admission and discharge dates are provided as character
strings, you can use <code><a href="../reference/checkBase.html">checkBase()</a></code> to try to parse them to a
date-time object, which uses internally the <code>lubridate</code>
functions. To do that, set the argument
<code>convertDates = TRUE</code>. You must also specify in what format
are the dates (“year-month-day”, “day-month-year”, etc.) by setting the
argument
<code>dateFormat = c("ymd", "ydm", "dmy", "dym", "mdy", "myd")</code>.</p></li>
</ul>
</div>
</div>
</div>
<div class="section level2">
<h2 id="the-hospinet-object">The <em>HospiNet</em> object<a class="anchor" aria-label="anchor" href="#the-hospinet-object"></a>
</h2>
<p><em>HospiNet</em> is an R6 object containing the facility matrix as
well as specific information regarding the network. We have developed a
<em>summary</em> and a <em>print</em> method for this object. The
information contained in an <em>HospiNet</em> objects are:</p>
<ul>
<li>
<em>n_facilities</em>, the number of facilities in the network,</li>
<li>
<em>n_subjects</em>, the number of subjects in the network,</li>
<li>
<em>n_movements</em>, the number direct or indirect (depending on
the window size) transfers,</li>
<li>
<em>window_threshold</em>, the size of the movement window in days
(0 for direct transfers between facilities),</li>
<li>
<em>hist_degrees</em>, <em>_in</em>, <em>_out</em>, are named
vectors containing the number of nodes for each degree, indegree, or
outdegree,</li>
<li>…</li>
</ul>
</div>
<div class="section level2">
<h2 id="using-the-package">Using the package<a class="anchor" aria-label="anchor" href="#using-the-package"></a>
</h2>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://pascalcrepey.github.io/HospitalNetwork/" class="external-link">HospitalNetwork</a></span><span class="op">)</span></span></code></pre></div>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">mydbmed</span> <span class="op">=</span> <span class="fu"><a href="../reference/create_fake_subjectDB.html">create_fake_subjectDB</a></span><span class="op">(</span>n_subjects <span class="op">=</span> <span class="fl">100</span>, n_facilities <span class="op">=</span> <span class="fl">10</span><span class="op">)</span></span>
<span><span class="va">hn</span> <span class="op">=</span> <span class="fu"><a href="../reference/hospinet_from_subject_database.html">hospinet_from_subject_database</a></span><span class="op">(</span>base <span class="op">=</span> <span class="va">mydbmed</span>, noloops <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span>
<span><span class="co">#&gt; Input database was not checked yet, which is required for network reconstruction.</span></span>
<span><span class="co">#&gt;               Running 'checkBase()' with default parameters.</span></span>
<span><span class="co">#&gt;               If this doesn't work, please run checkBase() separatelty with custom parameters first.</span></span>
<span><span class="va">hn</span></span>
<span><span class="co">#&gt; 10 facilities and 142 movements.</span></span>
<span><span class="co">#&gt; Movement window is 365 days.</span></span>
<span><span class="co">#&gt; Constructing full matrix</span></span>
<span><span class="co">#&gt;     f01 f02 f03 f04 f05 f06 f07 f08 f09 f10</span></span>
<span><span class="co">#&gt; f01   1   2   2   2   1   2   1   1   4   1</span></span>
<span><span class="co">#&gt; f02   1   4   1   3   1   0   0   1   4   1</span></span>
<span><span class="co">#&gt; f03   2   1   4   0   3   1   1   2   3   1</span></span>
<span><span class="co">#&gt; f04   0   1   2   3   1   0   2   0   1   1</span></span>
<span><span class="co">#&gt; f05   2   1   2   1   4   0   1   3   0   1</span></span>
<span><span class="co">#&gt; f06   0   3   2   2   1   1   1   0   1   0</span></span>
<span><span class="co">#&gt; f07   0   2   0   1   1   2   1   3   1   1</span></span>
<span><span class="co">#&gt; f08   4   2   0   2   0   1   0   1   0   3</span></span>
<span><span class="co">#&gt; f09   2   3   1   2   3   0   3   0   2   0</span></span>
<span><span class="co">#&gt; f10   1   1   1   2   1   2   1   1   1   2</span></span></code></pre></div>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">hn</span><span class="op">)</span></span></code></pre></div>
<p><img src="HospitalNetwork-Workflow_files/figure-html/setup3-1.png" width="700"></p>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">hn</span>, type <span class="op">=</span> <span class="st">"degree"</span><span class="op">)</span></span></code></pre></div>
<p><img src="HospitalNetwork-Workflow_files/figure-html/setup4-1.png" width="700"></p>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">hn</span> , type <span class="op">=</span> <span class="st">"clustered_matrix"</span><span class="op">)</span></span></code></pre></div>
<p><img src="HospitalNetwork-Workflow_files/figure-html/setup5-1.png" width="700"></p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span></span>
<span><span class="va">mydb</span> <span class="op">=</span> <span class="fu"><a href="../reference/create_fake_subjectDB_clustered.html">create_fake_subjectDB_clustered</a></span><span class="op">(</span>n_subjects <span class="op">=</span> <span class="fl">10000</span>, n_facilities <span class="op">=</span> <span class="fl">100</span>, n_clusters <span class="op">=</span> <span class="fl">5</span><span class="op">)</span></span>
<span><span class="va">hn</span> <span class="op">=</span> <span class="fu"><a href="../reference/hospinet_from_subject_database.html">hospinet_from_subject_database</a></span><span class="op">(</span>base <span class="op">=</span> <span class="va">mydb</span>, noloops <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span>
<span><span class="co">#&gt; Input database was not checked yet, which is required for network reconstruction.</span></span>
<span><span class="co">#&gt;               Running 'checkBase()' with default parameters.</span></span>
<span><span class="co">#&gt;               If this doesn't work, please run checkBase() separatelty with custom parameters first.</span></span>
<span><span class="va">hn</span></span>
<span><span class="co">#&gt; 100 facilities and 18169 movements.</span></span>
<span><span class="co">#&gt; Movement window is 365 days. </span></span>
<span><span class="co">#&gt; Matrix too big to be printed on screen.</span></span></code></pre></div>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">hn</span><span class="op">)</span></span></code></pre></div>
<p><img src="HospitalNetwork-Workflow_files/figure-html/setup7-1.png" width="700"></p>
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">hn</span>, type <span class="op">=</span> <span class="st">"degree"</span><span class="op">)</span></span></code></pre></div>
<p><img src="HospitalNetwork-Workflow_files/figure-html/setup8-1.png" width="700"></p>
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">hn</span> , type <span class="op">=</span> <span class="st">"clustered_matrix"</span><span class="op">)</span></span></code></pre></div>
<p><img src="HospitalNetwork-Workflow_files/figure-html/setup9-1.png" width="700"></p>
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">hn</span> , type <span class="op">=</span> <span class="st">"circular_network"</span><span class="op">)</span></span>
<span><span class="co">#&gt; Constructing full matrix</span></span>
<span><span class="co">#&gt; Warning: Removed 100 rows containing missing values</span></span>
<span><span class="co">#&gt; (`geom_edge_path()`).</span></span></code></pre></div>
<p><img src="HospitalNetwork-Workflow_files/figure-html/setup10-1.png" width="700"></p>
</div>
  </div>

  <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">

        <nav id="toc" data-toggle="toc"><h2 data-toc-skip>Contents</h2>
    </nav>
</div>

</div>



      <footer><div class="copyright">
  <p></p>
<p>Developed by Pascal Crépey, Tjibbe Donker, Clément Massonnaud, Michael Lydeamore.</p>
</div>

<div class="pkgdown">
  <p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.6.</p>
</div>

      </footer>
</div>

  


  

  </body>
</html>
