mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 07:26:13 +01:00
(v0.6.1.9043) age doc fix
This commit is contained in:
parent
8b5e2b030b
commit
1f8ee3ec3e
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 0.6.1.9042
|
||||
Date: 2019-05-29
|
||||
Version: 0.6.1.9043
|
||||
Date: 2019-05-30
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
person(
|
||||
|
2
R/age.R
2
R/age.R
@ -107,7 +107,7 @@ age <- function(x, reference = Sys.Date()) {
|
||||
#' # resistance of ciprofloxacine per age group
|
||||
#' library(dplyr)
|
||||
#' septic_patients %>%
|
||||
#' filter_first_isolate) %>%
|
||||
#' filter_first_isolate() %>%
|
||||
#' filter(mo == as.mo("E. coli")) %>%
|
||||
#' group_by(age_group = age_groups(age)) %>%
|
||||
#' select(age_group, CIP) %>%
|
||||
|
@ -162,9 +162,9 @@ ggplot_rsi <- function(data,
|
||||
language = get_locale(),
|
||||
fun = count_df,
|
||||
nrow = NULL,
|
||||
datalabels = TRUE,
|
||||
datalabels = FALSE,
|
||||
datalabels.size = 3,
|
||||
datalabels.colour = "grey15",
|
||||
datalabels.colour = "white",
|
||||
...) {
|
||||
|
||||
stopifnot_installed_package("ggplot2")
|
||||
@ -209,7 +209,7 @@ ggplot_rsi <- function(data,
|
||||
position <- "fill"
|
||||
}
|
||||
if (fun_name == "portion_df"
|
||||
| (fun_name == "count_df" & position == "fill")) {
|
||||
| (fun_name == "count_df" & identical(position, "fill"))) {
|
||||
# portions, so use y scale with percentage
|
||||
p <- p + scale_y_percent(breaks = breaks, limits = limits)
|
||||
}
|
||||
@ -361,13 +361,13 @@ theme_rsi <- function() {
|
||||
labels_rsi_count <- function(position = NULL,
|
||||
x = "Antibiotic",
|
||||
datalabels.size = 3,
|
||||
datalabels.colour = "grey15") {
|
||||
datalabels.colour = "white") {
|
||||
stopifnot_installed_package("ggplot2")
|
||||
if (is.null(position)) {
|
||||
position <- "fill"
|
||||
}
|
||||
if (position == "fill") {
|
||||
position <- ggplot2::position_fill(vjust = 0.5)
|
||||
if (identical(position, "fill")) {
|
||||
position <- ggplot2::position_fill(vjust = 0.5, reverse = TRUE)
|
||||
}
|
||||
ggplot2::geom_text(mapping = ggplot2::aes_string(label = "lbl",
|
||||
x = x,
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9042</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9043</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9042</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9043</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9042</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9043</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9042</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9043</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9042</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9043</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9042</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9043</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -291,38 +291,37 @@
|
||||
|
||||
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"># NOT RUN {
|
||||
ages <- c(3, 8, 16, 54, 31, 76, 101, 43, 21)
|
||||
<pre class="examples"><span class='co'># NOT RUN {</span>
|
||||
<span class='no'>ages</span> <span class='kw'><-</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>3</span>, <span class='fl'>8</span>, <span class='fl'>16</span>, <span class='fl'>54</span>, <span class='fl'>31</span>, <span class='fl'>76</span>, <span class='fl'>101</span>, <span class='fl'>43</span>, <span class='fl'>21</span>)
|
||||
|
||||
# split into 0-49 and 50+
|
||||
age_groups(ages, 50)
|
||||
<span class='co'># split into 0-49 and 50+</span>
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='fl'>50</span>)
|
||||
|
||||
# split into 0-19, 20-49 and 50+
|
||||
age_groups(ages, c(20, 50))
|
||||
<span class='co'># split into 0-19, 20-49 and 50+</span>
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>20</span>, <span class='fl'>50</span>))
|
||||
|
||||
# split into groups of ten years
|
||||
age_groups(ages, 1:10 * 10)
|
||||
age_groups(ages, split_at = "tens")
|
||||
<span class='co'># split into groups of ten years</span>
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='fl'>1</span>:<span class='fl'>10</span> * <span class='fl'>10</span>)
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='kw'>split_at</span> <span class='kw'>=</span> <span class='st'>"tens"</span>)
|
||||
|
||||
# split into groups of five years
|
||||
age_groups(ages, 1:20 * 5)
|
||||
age_groups(ages, split_at = "fives")
|
||||
<span class='co'># split into groups of five years</span>
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='fl'>1</span>:<span class='fl'>20</span> * <span class='fl'>5</span>)
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='kw'>split_at</span> <span class='kw'>=</span> <span class='st'>"fives"</span>)
|
||||
|
||||
# split specifically for children
|
||||
age_groups(ages, "children")
|
||||
# same:
|
||||
age_groups(ages, c(1, 2, 4, 6, 13, 17))
|
||||
<span class='co'># split specifically for children</span>
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='st'>"children"</span>)
|
||||
<span class='co'># same:</span>
|
||||
<span class='fu'>age_groups</span>(<span class='no'>ages</span>, <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='fl'>1</span>, <span class='fl'>2</span>, <span class='fl'>4</span>, <span class='fl'>6</span>, <span class='fl'>13</span>, <span class='fl'>17</span>))
|
||||
|
||||
# resistance of ciprofloxacine per age group
|
||||
library(dplyr)
|
||||
septic_patients %>%
|
||||
filter_first_isolate) %>%
|
||||
filter(mo == as.mo("E. coli")) %>%
|
||||
group_by(age_group = age_groups(age)) %>%
|
||||
select(age_group, CIP) %>%
|
||||
ggplot_rsi(x = "age_group")
|
||||
# }
|
||||
</pre>
|
||||
<span class='co'># resistance of ciprofloxacine per age group</span>
|
||||
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
|
||||
<span class='no'>septic_patients</span> <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='first_isolate.html'>filter_first_isolate</a></span>() <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>age_group</span> <span class='kw'>=</span> <span class='fu'>age_groups</span>(<span class='no'>age</span>)) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span>(<span class='no'>age_group</span>, <span class='no'>CIP</span>) <span class='kw'>%>%</span>
|
||||
<span class='fu'><a href='ggplot_rsi.html'>ggplot_rsi</a></span>(<span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"age_group"</span>)
|
||||
<span class='co'># }</span></pre>
|
||||
</div>
|
||||
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
|
||||
<h2>Contents</h2>
|
||||
|
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9040</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9043</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -252,8 +252,8 @@
|
||||
<span class='kw'>fill</span> <span class='kw'>=</span> <span class='st'>"Interpretation"</span>, <span class='kw'>facet</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>breaks</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/seq'>seq</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>0.1</span>),
|
||||
<span class='kw'>limits</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>translate_ab</span> <span class='kw'>=</span> <span class='st'>"name"</span>, <span class='kw'>combine_SI</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
|
||||
<span class='kw'>combine_IR</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>language</span> <span class='kw'>=</span> <span class='fu'><a href='translate.html'>get_locale</a></span>(), <span class='kw'>fun</span> <span class='kw'>=</span> <span class='no'>count_df</span>,
|
||||
<span class='kw'>nrow</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>datalabels</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>datalabels.size</span> <span class='kw'>=</span> <span class='fl'>3</span>,
|
||||
<span class='kw'>datalabels.colour</span> <span class='kw'>=</span> <span class='st'>"grey15"</span>, <span class='no'>...</span>)
|
||||
<span class='kw'>nrow</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>datalabels</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>datalabels.size</span> <span class='kw'>=</span> <span class='fl'>3</span>,
|
||||
<span class='kw'>datalabels.colour</span> <span class='kw'>=</span> <span class='st'>"white"</span>, <span class='no'>...</span>)
|
||||
|
||||
<span class='fu'>geom_rsi</span>(<span class='kw'>position</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>x</span> <span class='kw'>=</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/c'>c</a></span>(<span class='st'>"Antibiotic"</span>, <span class='st'>"Interpretation"</span>),
|
||||
<span class='kw'>fill</span> <span class='kw'>=</span> <span class='st'>"Interpretation"</span>, <span class='kw'>translate_ab</span> <span class='kw'>=</span> <span class='st'>"name"</span>,
|
||||
@ -269,7 +269,7 @@
|
||||
<span class='fu'>theme_rsi</span>()
|
||||
|
||||
<span class='fu'>labels_rsi_count</span>(<span class='kw'>position</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, <span class='kw'>x</span> <span class='kw'>=</span> <span class='st'>"Antibiotic"</span>,
|
||||
<span class='kw'>datalabels.size</span> <span class='kw'>=</span> <span class='fl'>3</span>, <span class='kw'>datalabels.colour</span> <span class='kw'>=</span> <span class='st'>"grey15"</span>)</pre>
|
||||
<span class='kw'>datalabels.size</span> <span class='kw'>=</span> <span class='fl'>3</span>, <span class='kw'>datalabels.colour</span> <span class='kw'>=</span> <span class='st'>"white"</span>)</pre>
|
||||
|
||||
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
||||
<table class="ref-arguments">
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9042</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.1.9043</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -55,7 +55,7 @@ echo "••••••••••••••••••••••••
|
||||
echo "• Uploading to repository •"
|
||||
echo "•••••••••••••••••••••••••••"
|
||||
git add .
|
||||
git commit -a -m "$1" --quiet
|
||||
git commit -a -m "(v$new_version) $1" --quiet
|
||||
git push --quiet
|
||||
echo "Comparison:"
|
||||
echo "https://gitlab.com/msberends/AMR/compare/master...premaster?view=inline"
|
||||
|
@ -61,7 +61,7 @@ age_groups(ages, c(1, 2, 4, 6, 13, 17))
|
||||
# resistance of ciprofloxacine per age group
|
||||
library(dplyr)
|
||||
septic_patients \%>\%
|
||||
filter_first_isolate) \%>\%
|
||||
filter_first_isolate() \%>\%
|
||||
filter(mo == as.mo("E. coli")) \%>\%
|
||||
group_by(age_group = age_groups(age)) \%>\%
|
||||
select(age_group, CIP) \%>\%
|
||||
|
@ -14,8 +14,8 @@ ggplot_rsi(data, position = NULL, x = "Antibiotic",
|
||||
fill = "Interpretation", facet = NULL, breaks = seq(0, 1, 0.1),
|
||||
limits = NULL, translate_ab = "name", combine_SI = TRUE,
|
||||
combine_IR = FALSE, language = get_locale(), fun = count_df,
|
||||
nrow = NULL, datalabels = TRUE, datalabels.size = 3,
|
||||
datalabels.colour = "grey15", ...)
|
||||
nrow = NULL, datalabels = FALSE, datalabels.size = 3,
|
||||
datalabels.colour = "white", ...)
|
||||
|
||||
geom_rsi(position = NULL, x = c("Antibiotic", "Interpretation"),
|
||||
fill = "Interpretation", translate_ab = "name",
|
||||
@ -31,7 +31,7 @@ scale_rsi_colours()
|
||||
theme_rsi()
|
||||
|
||||
labels_rsi_count(position = NULL, x = "Antibiotic",
|
||||
datalabels.size = 3, datalabels.colour = "grey15")
|
||||
datalabels.size = 3, datalabels.colour = "white")
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{a \code{data.frame} with column(s) of class \code{"rsi"} (see \code{\link{as.rsi}})}
|
||||
|
Loading…
Reference in New Issue
Block a user