diff --git a/DESCRIPTION b/DESCRIPTION index 8b6e9edc..a5cb48d5 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.2.0.9001 -Date: 2018-05-30 +Version: 0.2.0.9002 +Date: 2018-05-31 Title: Antimicrobial Resistance Analysis Authors@R: c( person( diff --git a/NEWS.md b/NEWS.md index 4fbd454b..615fbdde 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# 0.2.0.9000 (development version) +# 0.2.0.90xx (development version) #### New * Vignettes about frequency tables * Possibility to globally set the default for the amount of items to print in frequency tables (`freq` function), with `options(max.print.freq = n)` @@ -6,6 +6,8 @@ #### Changed * Renamed `toConsole` parameter of `freq` to `as.data.frame` * Small translational improvements to the `septic_patients` dataset +* Coerce RSI values from combined MIC/RSI values: `as.rsi("<=0.002; S")` will now return `"S"` +* Fix for warning `hybrid evaluation forced for row_number` from the `dplyr` package v0.7.5 and above. # 0.2.0 (latest stable version) #### New diff --git a/R/classes.R b/R/classes.R index a49a3a65..4a55d210 100755 --- a/R/classes.R +++ b/R/classes.R @@ -44,7 +44,7 @@ as.rsi <- function(x) { # remove all spaces x <- gsub(' +', '', x) # remove all MIC-like values: numbers, operators and periods - x <- gsub('[0-9.,<=>]+', '', x) + x <- gsub('[0-9.,;:<=>]+', '', x) # disallow more than 3 characters x[nchar(x) > 3] <- NA # set to capitals diff --git a/R/first_isolates.R b/R/first_isolates.R index d8109e81..1dba01c3 100755 --- a/R/first_isolates.R +++ b/R/first_isolates.R @@ -292,12 +292,15 @@ first_isolate <- function(tbl, } scope.size <- tbl %>% - filter(row_number() %>% - between(row.start, - row.end), - genus != '') %>% + filter( + suppressWarnings( + row_number() %>% between(row.start, + row.end) + ), + genus != '') %>% nrow() + # Analysis of first isolate ---- all_first <- tbl %>% mutate(other_pat_or_mo = if_else(patient_id == lag(patient_id) @@ -336,13 +339,14 @@ first_isolate <- function(tbl, mutate( real_first_isolate = if_else( - between(row_number(), row.start, row.end) + suppressWarnings(between(row_number(), row.start, row.end)) & genus != '' & (other_pat_or_mo | days_diff >= episode_days | key_ab_other), TRUE, FALSE)) + if (info == TRUE) { cat('\n') } @@ -351,7 +355,7 @@ first_isolate <- function(tbl, mutate( real_first_isolate = if_else( - between(row_number(), row.start, row.end) + suppressWarnings(between(row_number(), row.start, row.end)) & genus != '' & (other_pat_or_mo | days_diff >= episode_days), diff --git a/R/freq.R b/R/freq.R index 6aacc2b2..49705d84 100755 --- a/R/freq.R +++ b/R/freq.R @@ -349,7 +349,6 @@ freq <- function(x, ' (', (Count.rest / length(x)) %>% percent(force_zero = TRUE), ') ]\n', sep = '') - cat('\n') } else { print( diff --git a/R/print.R b/R/print.R index 09138087..a631ac22 100755 --- a/R/print.R +++ b/R/print.R @@ -204,7 +204,12 @@ prettyprint_df <- function(x, # class will be marked up per column if (NROW(x.bak) > 0) { rownames.x <- rownames(x) - x <- x %>% filter(row_number() == 1) %>% rbind(x, stringsAsFactors = FALSE) + x <- x %>% + filter( + suppressWarnings( + row_number() == 1) + ) %>% + rbind(x, stringsAsFactors = FALSE) rownames(x) <- c('*', rownames.x) }