mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 18:06:12 +01:00
44 lines
1.5 KiB
R
Executable File
44 lines
1.5 KiB
R
Executable File
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/guess_bactid.R
|
|
\name{guess_bactid}
|
|
\alias{guess_bactid}
|
|
\title{Find bacteria ID based on genus/species}
|
|
\usage{
|
|
guess_bactid(x)
|
|
}
|
|
\arguments{
|
|
\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 \code{\link{select}} a genus and species column, zie Examples.
|
|
}
|
|
\examples{
|
|
# These examples all return "STAAUR", the ID of S. aureus:
|
|
guess_bactid("stau")
|
|
guess_bactid("STAU")
|
|
guess_bactid("staaur")
|
|
guess_bactid("S. aureus")
|
|
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.
|
|
}
|