1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 10:31:53 +02:00

Update freq function

This commit is contained in:
uscloud
2018-05-22 16:34:22 +02:00
parent 0d80647d41
commit dcc26dd942
71 changed files with 26 additions and 28 deletions

0
R/atc.R Normal file → Executable file
View File

0
R/classes.R Normal file → Executable file
View File

0
R/data.R Normal file → Executable file
View File

0
R/eucast.R Normal file → Executable file
View File

0
R/first_isolates.R Normal file → Executable file
View File

24
R/freq.R Normal file → Executable file
View File

@ -21,7 +21,7 @@
#' Create a frequency table of a vector of data, a single column or a maximum of 9 columns of a data frame. Supports markdown for reports.
#' @param x data
#' @param sort.count Sort on count. Use \code{FALSE} to sort alphabetically on item.
#' @param nmax number of row to print. The default, \code{15}, uses \code{\link[base]{getOption}("max.print.freq")}. Use \code{nmax = 0} or \code{nmax = NA} to print all rows.
#' @param nmax number of row to print. The default, \code{15}, uses \code{\link{getOption}("max.print.freq")}. Use \code{nmax = 0} or \code{nmax = NA} to print all rows.
#' @param na.rm a logical value indicating whether NA values should be removed from the frequency table. The header will always print the amount of \code{NA}s.
#' @param markdown print table in markdown format (this forces \code{nmax = NA})
#' @param as.data.frame return frequency table without header as a \code{data.frame} (e.g. to assign the table to an object)
@ -337,18 +337,18 @@ freq <- function(x,
align = column_align,
padding = 1)
)
cat('... and ',
format(nrow(df) - nmax),
' more ',
paste0('(n = ',
format(Count.rest),
'; ',
(Count.rest / length(x)) %>% percent(force_zero = TRUE),
')'),
'.', sep = '')
if (nmax.set == FALSE) {
cat(' Use `nmax` to show more or less rows.')
if (nmax.set == TRUE) {
cat('[ reached `nmax = ', nmax, '`', sep = '')
} else {
cat('[ reached getOption("max.print.freq")')
}
cat(' -- omitted ',
format(nrow(df) - nmax),
' entries, n = ',
format(Count.rest),
' (',
(Count.rest / length(x)) %>% percent(force_zero = TRUE),
') ]\n', sep = '')
cat('\n')
} else {

0
R/globals.R Normal file → Executable file
View File

0
R/join.R Normal file → Executable file
View File

0
R/mdro.R Normal file → Executable file
View File

0
R/misc.R Normal file → Executable file
View File

0
R/print.R Normal file → Executable file
View File

0
R/rsi_analysis.R Normal file → Executable file
View File

0
R/zzz.R Normal file → Executable file
View File