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

fix for printing tibbles, improve guess_bactid

This commit is contained in:
2018-06-08 12:06:54 +02:00
parent efdf5a3dc5
commit 0a5898b17d
12 changed files with 306 additions and 209 deletions

View File

@ -21,7 +21,7 @@ first_isolate(tbl, col_date, col_patient_id, col_bactid = NA,
\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)}
\item{col_bactid}{column name of the unique IDs of the microorganisms (should occur in the \code{\link{microorganisms}} dataset). Get your bactid's with the function \code{\link{guess_bactid}}, that takes microorganism names as input.}
\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.}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/atc.R
% Please edit documentation in R/guess_bactid.R
\name{guess_bactid}
\alias{guess_bactid}
\title{Find bacteria ID based on genus/species}
@ -7,13 +7,13 @@
guess_bactid(x)
}
\arguments{
\item{x}{character vector to determine \code{bactid}}
\item{x}{character vector or a dataframe with one or two columns}
}
\value{
Character (vector).
}
\description{
Use this function to determine a valid ID based on a genus (and species). This input could be a full name (like \code{"Staphylococcus aureus"}), an abbreviated name (like \code{"S. aureus"}), or just a genus. You could also use a \code{\link{paste}} of a genus and species column to use the full name as input: \code{x = paste(df$genus, df$species)}, where \code{df} is your dataframe.
Use this function to determine a valid ID based on a genus (and species). This input could be a full name (like \code{"Staphylococcus aureus"}), an abbreviated name (like \code{"S. aureus"}), or just a genus. You could also \code{\link{select}} a genus and species column, zie Examples.
}
\examples{
# These examples all return "STAAUR", the ID of S. aureus:
@ -25,6 +25,18 @@ guess_bactid("S aureus")
guess_bactid("Staphylococcus aureus")
guess_bactid("MRSA") # Methicillin-resistant S. aureus
guess_bactid("VISA") # Vancomycin Intermediate S. aureus
\dontrun{
df$bactid <- guess_bactid(df$microorganism_name)
# the select function of tidyverse is also supported:
df$bactid <- df \%>\% select(microorganism_name) \%>\% guess_bactid()
# and can even contain 2 columns, which is convenient for genus/species combinations:
df$bactid <- df \%>\% select(genus, species) \%>\% guess_bactid()
# same result:
df <- df \%>\% mutate(bactid = paste(genus, species) \%>\% guess_bactid())
}
}
\seealso{
\code{\link{microorganisms}} for the dataframe that is being used to determine ID's.

View File

@ -14,9 +14,9 @@ key_antibiotics(tbl, col_bactid = "bactid", info = TRUE, amcl = "amcl",
\arguments{
\item{tbl}{table with antibiotics coloms, like \code{amox} and \code{amcl}.}
\item{col_bactid}{column of bacteria IDs in \code{tbl}; these should occur in \code{microorganisms$bactid}, see \code{\link{microorganisms}}}
\item{col_bactid}{column name of the unique IDs of the microorganisms (should occur in the \code{\link{microorganisms}} dataset). Get your bactid's with the function \code{\link{guess_bactid}}, that takes microorganism names as input.}
\item{info}{print warnings}
\item{info}{print progress}
\item{amcl, amox, cfot, cfta, cftr, cfur, cipr, clar, clin, clox, doxy, gent, line, mero, peni, pita, rifa, teic, trsu, vanc}{column names of antibiotics, case-insensitive}
}