From 5593aee19e44a76da46096a4f446ce8fcba765ca Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Wed, 30 May 2018 23:02:16 +0200 Subject: [PATCH] edit as.rsi algor. --- DESCRIPTION | 5 ++--- R/classes.R | 4 ++-- R/freq.R | 2 +- man/freq.Rd | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3f40d08a..8b6e9edc 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.2.0.9000 -Date: 2018-05-22 +Version: 0.2.0.9001 +Date: 2018-05-30 Title: Antimicrobial Resistance Analysis Authors@R: c( person( @@ -38,7 +38,6 @@ Imports: Suggests: testthat (>= 1.0.2), covr (>= 3.0.1), - knitr, rmarkdown VignetteBuilder: knitr URL: https://github.com/msberends/AMR diff --git a/R/classes.R b/R/classes.R index 20c7db64..56f915ce 100755 --- a/R/classes.R +++ b/R/classes.R @@ -43,8 +43,8 @@ as.rsi <- function(x) { na_before <- x[is.na(x) | x == ''] %>% length() # remove all spaces x <- gsub(' {2,55}', '', x) - # disallow more than 3 characters - x[nchar(x) > 3] <- NA + # disallow more than 10 characters to start with + x[nchar(x) > 10] <- NA # remove all invalid characters x <- gsub('[^RSI]+', '', x %>% toupper()) # needed for UMCG in cases of "S;S" but also "S;I"; the latter will be NA: diff --git a/R/freq.R b/R/freq.R index dbbc1e7b..6aacc2b2 100755 --- a/R/freq.R +++ b/R/freq.R @@ -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. #' @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 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}) diff --git a/man/freq.Rd b/man/freq.Rd index 32f30029..51f9f748 100755 --- a/man/freq.Rd +++ b/man/freq.Rd @@ -16,7 +16,7 @@ frequency_tbl(x, sort.count = TRUE, nmax = getOption("max.print.freq"), \arguments{ \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.}