mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 23:21:56 +02:00
try to support older R versions
This commit is contained in:
2
R/freq.R
2
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(
|
||||
|
9
R/misc.R
9
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user