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

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 # Setting up R deps
language: r language: r
r: 3.2 r: 3.1
r_packages: covr r_packages: covr
cache: packages cache: packages

View File

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

View File

@ -57,6 +57,7 @@ exportMethods(print.tbl)
exportMethods(print.tbl_df) exportMethods(print.tbl_df)
exportMethods(summary.mic) exportMethods(summary.mic)
exportMethods(summary.rsi) exportMethods(summary.rsi)
importFrom(data.table,data.table)
importFrom(dplyr,"%>%") importFrom(dplyr,"%>%")
importFrom(dplyr,all_vars) importFrom(dplyr,all_vars)
importFrom(dplyr,any_vars) importFrom(dplyr,any_vars)

View File

@ -9,6 +9,7 @@
- New print format for tibbles and data.tables - New print format for tibbles and data.tables
#### Changed #### Changed
- Support for older R versions, only R 3.1.0 and later is needed
- Renamed dataset `ablist` to `antibiotics` - Renamed dataset `ablist` to `antibiotics`
- Renamed dataset `bactlist` to `microorganisms` - Renamed dataset `bactlist` to `microorganisms`
- Added more microorganisms to `bactlist` - Added more microorganisms to `bactlist`

View File

@ -337,7 +337,7 @@ freq <- function(x,
'; ', '; ',
(Count.rest / length(x)) %>% percent(force_zero = TRUE), (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 { } else {
print( 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 <- paste(sprintf(paste0("%.", decimals, "f"), bytes / (1024 ^ factor)), size[factor + 1])
out 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 #' @rdname print
#' @name print #' @name print
#' @importFrom dplyr %>% n_groups group_vars group_size filter pull select #' @importFrom dplyr %>% n_groups group_vars group_size filter pull select
#' @importFrom data.table data.table
#' @exportMethod print.tbl_df #' @exportMethod print.tbl_df
#' @export #' @export
#' @examples #' @examples