try to support older R versions

This commit is contained in:
dr. M.S. (Matthijs) Berends 2018-04-18 14:50:16 +02:00
parent 2509e2413d
commit a814d82b4b
7 changed files with 15 additions and 3 deletions

View File

@ -2,7 +2,7 @@
# Setting up R deps
language: r
r: 3.2
r: 3.1
r_packages: covr
cache: packages

View File

@ -25,7 +25,7 @@ Description: Functions to simplify the analysis of Antimicrobial Resistance (AMR
on antibiograms according to Leclercq (2013)
<doi:10.1111/j.1469-0691.2011.03703.x>.
Depends:
R (>= 3.2.0)
R (>= 3.1.0)
Imports:
dplyr (>= 0.7.0),
data.table (>= 1.10.0),

View File

@ -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)

View File

@ -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`

View File

@ -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(

View File

@ -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
}

View File

@ -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