1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 06:02:01 +02:00

fix clipboard on linux

This commit is contained in:
2018-04-02 11:11:21 +02:00
parent abcb4accbd
commit c182a9673d
12 changed files with 181 additions and 176 deletions

View File

@ -41,7 +41,7 @@ clipboard_export(x, sep = "\\t", dec = ".", na = "", header = TRUE,
data.frame
}
\description{
These are helper functions around \code{\link{read.table}} and \code{\link{write.table}} to import from and export to clipboard. The data will be read and written as tab-separated by default, which makes it possible to copy and paste from other software like Excel and SPSS without further transformation.
These are helper functions around \code{\link{read.table}} and \code{\link{write.table}} to import from and export to clipboard, with support for Windows, Linux and macOS. The data will be read and written as tab-separated by default, which makes it possible to copy and paste from other software like Excel and SPSS without further transformation.
}
\details{
For \code{clipboard_export}, the reserved clipboard size for exporting will be set automatically to 125\% of the object size of \code{x}. This way, it is possible to export data with thousands of rows as the only limit will be your systems RAM.

View File

@ -14,17 +14,17 @@ first_isolate(tbl, col_date, col_patient_id, col_bactid = NA,
\arguments{
\item{tbl}{a \code{data.frame} containing isolates.}
\item{col_date}{column name of the result date (or date that is was received on the lab), supports tidyverse-like quotation}
\item{col_date}{column name of the result date (or date that is was received on the lab)}
\item{col_patient_id}{column name of the unique IDs of the patients, supports tidyverse-like quotation}
\item{col_patient_id}{column name of the unique IDs of the patients}
\item{col_bactid}{column name of the unique IDs of the microorganisms (should occur in the \code{\link{microorganisms}} dataset), supports tidyverse-like quotation}
\item{col_bactid}{column name of the unique IDs of the microorganisms (should occur in the \code{\link{microorganisms}} dataset)}
\item{col_testcode}{column name of the test codes. Use \code{col_testcode = NA} to \strong{not} exclude certain test codes (like test codes for screening). In that case \code{testcodes_exclude} will be ignored. Supports tidyverse-like quotation.}
\item{col_specimen}{column name of the specimen type or group, supports tidyverse-like quotation}
\item{col_specimen}{column name of the specimen type or group}
\item{col_icu}{column name of the logicals (\code{TRUE}/\code{FALSE}) whether a ward or department is an Intensive Care Unit (ICU), supports tidyverse-like quotation}
\item{col_icu}{column name of the logicals (\code{TRUE}/\code{FALSE}) whether a ward or department is an Intensive Care Unit (ICU)}
\item{col_keyantibiotics}{column name of the key antibiotics to determine first \emph{weighted} isolates, see \code{\link{key_antibiotics}}. Supports tidyverse-like quotation.}
@ -46,9 +46,9 @@ first_isolate(tbl, col_date, col_patient_id, col_bactid = NA,
\item{info}{print progress}
\item{col_genus}{(deprecated, use \code{col_bactid} instead) column name of the genus of the microorganisms, supports tidyverse-like quotation}
\item{col_genus}{(deprecated, use \code{col_bactid} instead) column name of the genus of the microorganisms}
\item{col_species}{(deprecated, use \code{col_bactid} instead) column name of the species of the microorganisms, supports tidyverse-like quotation}
\item{col_species}{(deprecated, use \code{col_bactid} instead) column name of the species of the microorganisms}
}
\value{
A vector to add to table, see Examples.
@ -73,12 +73,10 @@ my_patients <- septic_patients
library(dplyr)
my_patients$first_isolate <- my_patients \%>\%
left_join_microorganisms() \%>\%
first_isolate(col_date = date,
col_patient_id = patient_id,
col_genus = genus,
col_species = species)
first_isolate(col_date = "date",
col_patient_id = "patient_id",
col_bactid = "bactid")
\dontrun{
# set key antibiotics to a new variable

View File

@ -38,31 +38,31 @@ my_data <- septic_patients
library(dplyr)
# Add first isolates to our dataset:
my_data <- my_data \%>\%
mutate(first_isolates = first_isolate(my_data, date, patient_id, bactid))
my_data <- my_data \%>\%
mutate(first_isolates = first_isolate(my_data, "date", "patient_id", "bactid"))
# -------- #
# ANALYSIS #
# -------- #
# 1. Get the amoxicillin resistance percentages
# 1. Get the amoxicillin resistance percentages
# of E. coli, divided by hospital:
my_data \%>\%
filter(bactid == "ESCCOL",
first_isolates == TRUE) \%>\%
group_by(hospital_id) \%>\%
first_isolates == TRUE) \%>\%
group_by(hospital_id) \%>\%
summarise(n = n(),
amoxicillin_resistance = rsi(amox))
# 2. Get the amoxicillin/clavulanic acid resistance
# 2. Get the amoxicillin/clavulanic acid resistance
# percentages of E. coli, trend over the years:
my_data \%>\%
my_data \%>\%
filter(bactid == guess_bactid("E. coli"),
first_isolates == TRUE) \%>\%
group_by(year = format(date, "\%Y")) \%>\%
first_isolates == TRUE) \%>\%
group_by(year = format(date, "\%Y")) \%>\%
summarise(n = n(),
amoxclav_resistance = rsi(amcl, minimum = 20))
}