diff --git a/.travis.yml b/.travis.yml index 4be52271..4a37d8ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ # Setting up R deps language: r -r: 3.2 +r: 3.1 r_packages: covr cache: packages diff --git a/DESCRIPTION b/DESCRIPTION index fbe4ac27..917405b5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,7 +25,7 @@ Description: Functions to simplify the analysis of Antimicrobial Resistance (AMR on antibiograms according to Leclercq (2013) . Depends: - R (>= 3.2.0) + R (>= 3.1.0) Imports: dplyr (>= 0.7.0), data.table (>= 1.10.0), diff --git a/NAMESPACE b/NAMESPACE index 3b36d900..0e0c60bf 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -57,6 +57,7 @@ exportMethods(print.tbl) exportMethods(print.tbl_df) exportMethods(summary.mic) exportMethods(summary.rsi) +importFrom(data.table,data.table) importFrom(dplyr,"%>%") importFrom(dplyr,all_vars) importFrom(dplyr,any_vars) diff --git a/NEWS.md b/NEWS.md index 5ed07fc0..cf984b00 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,7 @@ - New print format for tibbles and data.tables #### Changed +- Support for older R versions, only R 3.1.0 and later is needed - Renamed dataset `ablist` to `antibiotics` - Renamed dataset `bactlist` to `microorganisms` - Added more microorganisms to `bactlist` diff --git a/R/freq.R b/R/freq.R index fb6d6a47..bb592c0e 100644 --- a/R/freq.R +++ b/R/freq.R @@ -337,7 +337,7 @@ freq <- function(x, '; ', (Count.rest / length(x)) %>% percent(force_zero = TRUE), ')'), - '. Use `nmax` to show more rows.\n\n', sep = '') + '. Use `nmax` to show more rows.\n', sep = '') } else { print( diff --git a/R/misc.R b/R/misc.R index d0588eb4..b28f32dc 100644 --- a/R/misc.R +++ b/R/misc.R @@ -111,3 +111,12 @@ size_humanreadable <- function(bytes, decimals = 1) { out <- paste(sprintf(paste0("%.", decimals, "f"), bytes / (1024 ^ factor)), size[factor + 1]) out } + +# strrep is only available in R 3.3 and later +# and we want to support R 3.2 too, so: +strrep <- function(x, times) { + for (i in 1:length(x)) { + x[i] <- paste(rep(x[i], times[i]), collapse = "") + } + x +} diff --git a/R/print.R b/R/print.R index 377cb9ac..6cdb68d9 100644 --- a/R/print.R +++ b/R/print.R @@ -28,6 +28,7 @@ #' @rdname print #' @name print #' @importFrom dplyr %>% n_groups group_vars group_size filter pull select +#' @importFrom data.table data.table #' @exportMethod print.tbl_df #' @export #' @examples