* Function `is_new_episode()` to determine patient episodes which are not necessarily based on microorganisms. It also supports grouped variables with e.g. `mutate()`, `filter()` and `summarise()` of the `dplyr` package:
@ -30,6 +30,8 @@
* Fix for using parameter `reference_df` in `as.mo()` and `mo_*()` functions that contain old microbial codes (from previous package versions)
* Fix for using `as.rsi()` on a data.frame in older R versions
* `as.rsi()` on a data.frame will not print a message anymore if the values are already clean R/SI values
* Fixed a bug where `mo_uncertainties()` would not return the results based on the MO matching score
* Fixed a bug where `as.mo()` would not return results for known laboratory codes for microorganisms
### Other
* All messages and warnings thrown by this package now break sentences on whole words
message_("Using combined columns `",font_bold("First name"),"`, `",font_bold("Last name"),"` and `",font_bold("Sex"),"` as input for `col_patient_id`")
message_("Using combined columns '",font_bold("First name"),"', '",font_bold("Last name"),"' and '",font_bold("Sex"),"' as input for `col_patient_id`")
class_rsi<-sapply(rsi_translation,function(x)paste0("<",class(x),">",collapse=" and "))
class_ref<-sapply(reference_data,function(x)paste0("<",class(x),">",collapse=" and "))
if (!all(names(class_rsi)==names(class_ref))){
stop_("'reference_data' must have the same column names as the 'rsi_translation' data set.",call=-2)
stop_("`reference_data` must have the same column names as the 'rsi_translation' data set.",call=-2)
}
if (!all(class_rsi==class_ref)){
class_rsi[class_rsi!=class_ref][1]
stop_("'reference_data' must be the same structure as the 'rsi_translation' data set. Column '",names(class_ref[class_rsi!=class_ref][1]),"' is of class ",class_ref[class_rsi!=class_ref][1],", but should be of class ",class_rsi[class_rsi!=class_ref][1],".",call=-2)
stop_("`reference_data` must be the same structure as the 'rsi_translation' data set. Column '",names(class_ref[class_rsi!=class_ref][1]),"' is of class ",class_ref[class_rsi!=class_ref][1],", but should be of class ",class_rsi[class_rsi!=class_ref][1],".",call=-2)
times <spanclass="op">=</span><spanclass="fl">10</span><spanclass="op">)</span>
<spanclass="fu"><ahref="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><spanclass="op">(</span><spanclass="va">S.aureus</span>, unit <spanclass="op">=</span><spanclass="st">"ms"</span>, signif <spanclass="op">=</span><spanclass="fl">2</span><spanclass="op">)</span>
<spanclass="co"># Unit: milliseconds</span>
<spanclass="co"># expr min lq mean median uq max</span>
<spanclass="fu"><ahref="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><spanclass="op">(</span><spanclass="va">run_it</span>, unit <spanclass="op">=</span><spanclass="st">"ms"</span>, signif <spanclass="op">=</span><spanclass="fl">3</span><spanclass="op">)</span>
<spanclass="co"># Unit: milliseconds</span>
<spanclass="co"># expr min lq mean median uq max neval</span>
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.331 seconds. You only lose time on your unique input values.</p>
<p>So getting official taxonomic names of 2,000,000 (!!) items consisting of 90 unique values only takes 0.202 seconds. You only lose time on your unique input values.</p>
times <spanclass="op">=</span><spanclass="fl">10</span><spanclass="op">)</span>
<spanclass="fu"><ahref="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><spanclass="op">(</span><spanclass="va">run_it</span>, unit <spanclass="op">=</span><spanclass="st">"ms"</span>, signif <spanclass="op">=</span><spanclass="fl">3</span><spanclass="op">)</span>
<spanclass="co"># Unit: milliseconds</span>
<spanclass="co"># expr min lq mean median uq max neval</span>
<spanclass="co"># A 16.20 16.20 18.60 17.90 18.90 28.00 10</span>
<spanclass="co"># B 50.90 51.10 57.70 51.20 53.10 108.00 10</span>
<spanclass="co"># C 3.58 3.72 4.03 4.06 4.14 4.91 10</span></pre></div>
<p>So going from <code><ahref="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0041 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
<spanclass="co"># expr min lq mean median uq max neval</span>
<spanclass="co"># A 7.83 8.05 9.56 9.43 10.90 12.90 10</span>
<spanclass="co"># B 23.50 24.40 30.20 25.50 26.80 74.50 10</span>
<spanclass="co"># C 2.00 2.19 2.42 2.41 2.56 3.06 10</span></pre></div>
<p>So going from <code><ahref="../reference/mo_property.html">mo_name("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0024 seconds - it doesn’t even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
B <spanclass="op">=</span><spanclass="fu"><ahref="../reference/mo_property.html">mo_genus</a></span><spanclass="op">(</span><spanclass="st">"Staphylococcus"</span><spanclass="op">)</span>,
@ -317,14 +316,14 @@
<spanclass="fu"><ahref="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><spanclass="op">(</span><spanclass="va">run_it</span>, unit <spanclass="op">=</span><spanclass="st">"ms"</span>, signif <spanclass="op">=</span><spanclass="fl">3</span><spanclass="op">)</span>
<spanclass="co"># Unit: milliseconds</span>
<spanclass="co"># expr min lq mean median uq max neval</span>
<spanclass="co"># A 3.62 3.62 3.66 3.64 3.67 3.80 10</span>
<spanclass="co"># B 3.57 3.59 3.68 3.64 3.72 4.01 10</span>
<spanclass="co"># C 3.63 3.64 3.65 3.64 3.67 3.71 10</span>
<spanclass="co"># D 3.57 3.58 3.62 3.61 3.67 3.69 10</span>
<spanclass="co"># E 3.56 3.57 3.60 3.59 3.60 3.68 10</span>
<spanclass="co"># F 3.55 3.58 3.73 3.65 3.85 4.01 10</span>
<spanclass="co"># G 3.54 3.56 3.62 3.58 3.61 3.93 10</span>
<spanclass="co"># H 3.53 3.57 3.59 3.58 3.63 3.66 10</span></pre></div>
<spanclass="co"># A 1.69 1.75 1.90 1.86 2.00 2.25 10</span>
<spanclass="co"># B 1.69 1.72 1.86 1.79 1.87 2.43 10</span>
<spanclass="co"># C 1.67 1.75 1.89 1.81 1.93 2.67 10</span>
<spanclass="co"># D 1.64 1.73 1.87 1.87 1.94 2.23 10</span>
<spanclass="co"># E 1.65 1.75 1.90 1.83 1.92 2.35 10</span>
<spanclass="co"># F 1.70 1.75 1.87 1.85 1.93 2.20 10</span>
<spanclass="co"># G 1.73 1.83 1.93 1.93 2.01 2.25 10</span>
<spanclass="co"># H 1.65 1.73 1.85 1.77 2.06 2.11 10</span></pre></div>
<p>Of course, when running <code><ahref="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> anyway, there is no point in calculating the result. And because this package ‘knows’ all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.</p>
times <spanclass="op">=</span><spanclass="fl">100</span><spanclass="op">)</span>
<spanclass="fu"><ahref="https://docs.ropensci.org/skimr/reference/print.html">print</a></span><spanclass="op">(</span><spanclass="va">run_it</span>, unit <spanclass="op">=</span><spanclass="st">"ms"</span>, signif <spanclass="op">=</span><spanclass="fl">4</span><spanclass="op">)</span>
<spanclass="co"># Unit: milliseconds</span>
<spanclass="co"># expr min lq mean median uq max neval</span>
<spanclass="co"># en 35.85 36.13 41.92 36.29 36.84 318.20 100</span>
<spanclass="co"># de 42.37 42.67 45.11 42.91 43.19 95.04 100</span>
<ahref="#last-updated-1-december-2020"class="anchor"></a><small>Last updated: 1 December 2020</small>
<ahref="#last-updated-3-december-2020"class="anchor"></a><small>Last updated: 3 December 2020</small>
</h2>
<divid="new"class="section level3">
<h3class="hasAnchor">
@ -284,6 +284,8 @@
<li>Fix for using <code><ahref="../reference/as.rsi.html">as.rsi()</a></code> on a data.frame in older R versions</li>
<li>
<code><ahref="../reference/as.rsi.html">as.rsi()</a></code> on a data.frame will not print a message anymore if the values are already clean R/SI values</li>
<li>Fixed a bug where <code><ahref="../reference/as.mo.html">mo_uncertainties()</a></code> would not return the results based on the MO matching score</li>
<li>Fixed a bug where <code><ahref="../reference/as.mo.html">as.mo()</a></code> would not return results for known laboratory codes for microorganisms</li>