1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 07:26:13 +01:00

edit as.rsi algor.

This commit is contained in:
dr. M.S. (Matthijs) Berends 2018-05-30 23:02:16 +02:00
parent dcc26dd942
commit 5593aee19e
4 changed files with 6 additions and 7 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 0.2.0.9000 Version: 0.2.0.9001
Date: 2018-05-22 Date: 2018-05-30
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(
person( person(
@ -38,7 +38,6 @@ Imports:
Suggests: Suggests:
testthat (>= 1.0.2), testthat (>= 1.0.2),
covr (>= 3.0.1), covr (>= 3.0.1),
knitr,
rmarkdown rmarkdown
VignetteBuilder: knitr VignetteBuilder: knitr
URL: https://github.com/msberends/AMR URL: https://github.com/msberends/AMR

View File

@ -43,8 +43,8 @@ as.rsi <- function(x) {
na_before <- x[is.na(x) | x == ''] %>% length() na_before <- x[is.na(x) | x == ''] %>% length()
# remove all spaces # remove all spaces
x <- gsub(' {2,55}', '', x) x <- gsub(' {2,55}', '', x)
# disallow more than 3 characters # disallow more than 10 characters to start with
x[nchar(x) > 3] <- NA x[nchar(x) > 10] <- NA
# remove all invalid characters # remove all invalid characters
x <- gsub('[^RSI]+', '', x %>% toupper()) x <- gsub('[^RSI]+', '', x %>% toupper())
# needed for UMCG in cases of "S;S" but also "S;I"; the latter will be NA: # needed for UMCG in cases of "S;S" but also "S;I"; the latter will be NA:

View File

@ -20,7 +20,7 @@
#' #'
#' Create a frequency table of a vector of data, a single column or a maximum of 9 columns of a data frame. Supports markdown for reports. #' Create a frequency table of a vector of data, a single column or a maximum of 9 columns of a data frame. Supports markdown for reports.
#' @param x data #' @param x data
#' @param sort.count Sort on count. Use \code{FALSE} to sort alphabetically on item. #' @param sort.count sort on count. Use \code{FALSE} to sort alphabetically on item.
#' @param nmax number of row to print. The default, \code{15}, uses \code{\link{getOption}("max.print.freq")}. Use \code{nmax = 0} or \code{nmax = NA} to print all rows. #' @param nmax number of row to print. The default, \code{15}, uses \code{\link{getOption}("max.print.freq")}. Use \code{nmax = 0} or \code{nmax = NA} to print all rows.
#' @param na.rm a logical value indicating whether NA values should be removed from the frequency table. The header will always print the amount of \code{NA}s. #' @param na.rm a logical value indicating whether NA values should be removed from the frequency table. The header will always print the amount of \code{NA}s.
#' @param markdown print table in markdown format (this forces \code{nmax = NA}) #' @param markdown print table in markdown format (this forces \code{nmax = NA})

View File

@ -16,7 +16,7 @@ frequency_tbl(x, sort.count = TRUE, nmax = getOption("max.print.freq"),
\arguments{ \arguments{
\item{x}{data} \item{x}{data}
\item{sort.count}{Sort on count. Use \code{FALSE} to sort alphabetically on item.} \item{sort.count}{sort on count. Use \code{FALSE} to sort alphabetically on item.}
\item{nmax}{number of row to print. The default, \code{15}, uses \code{\link{getOption}("max.print.freq")}. Use \code{nmax = 0} or \code{nmax = NA} to print all rows.} \item{nmax}{number of row to print. The default, \code{15}, uses \code{\link{getOption}("max.print.freq")}. Use \code{nmax = 0} or \code{nmax = NA} to print all rows.}