├── .Rbuildignore ├── .gitattributes ├── .github └── workflows │ ├── check-standard.yaml.bak │ └── rhub.yaml ├── .gitignore ├── DESCRIPTION ├── NAMESPACE ├── NEWS.md ├── R ├── args_validation.R ├── cleartmp.R ├── ctable.R ├── define_keywords.R ├── descr.R ├── dfSummary.R ├── examens.R ├── exams.R ├── freq.R ├── helpers.R ├── label.R ├── parse_call.R ├── print.list.R ├── print.stby.R ├── print.summarytools.R ├── st_css.R ├── st_options.R ├── stby.R ├── summarytools.R ├── sysdata.rda ├── tabagisme.R ├── tb.R ├── tobacco.R ├── use_custom_lang.R ├── view.R ├── what.is.R └── zzz.R ├── README.Rmd ├── README.md ├── data ├── examens.RData ├── exams.RData ├── tabagisme.RData └── tobacco.RData ├── doc ├── Custom-Statistics-in-dfSummary.Rmd ├── Custom-Statistics-in-dfSummary.html ├── Custom-Statistics-in-dfSummary.pdf ├── Data-Frame-Summaries-in-PDFs.Rmd ├── Data-Frame-Summaries-in-PDFs.pdf ├── Introduction.Rmd ├── assets │ ├── define_keywords.png │ ├── dfSummary_in_RStudio_Viewer.png │ ├── dfSummary_md.png │ ├── exclamation-diamond.svg │ ├── lightbulb.svg │ └── vignette.css ├── include-header.tex ├── include-renew-cmd.tex ├── introduction.R ├── introduction.html ├── rmarkdown.R ├── rmarkdown.Rmd └── rmarkdown.html ├── img ├── Russian-freq.png ├── bmc_qr.png ├── collage.pdn ├── collage.png ├── ctable-barebones-2.png ├── ctable-barebones.png ├── ctable-chisq.png ├── ctable-minimal.png ├── ctable-row-proportions.png ├── ctable-statistics.png ├── ctable-with-row-props.png ├── define-keywords.png ├── define_keywords.png ├── descr-kableExtra.png ├── dfSummary-in-RStudio-Viewer.png ├── dfSummary-render-in-markdown.png ├── dfSummary-scroll-window.png ├── dfSummary_in_RStudio_Viewer.png ├── dfSummary_md.png ├── freq-fr.png ├── logo.png ├── paypal-blue.svg ├── paypal-grey.svg ├── repository-open-graph-template.pdn ├── st-banner-fuzzy.png ├── summarytools-card.pdn ├── summarytools-card.png ├── summarytools-tabletop.png ├── summarytools-text.dtp └── tb-kableExtra.png ├── inst ├── WORDLIST └── includes │ ├── favicon.html │ ├── fig-valign.tex │ ├── language_template.csv │ ├── scripts │ ├── bootstrap.min.js │ ├── bootstrap.min.js.map │ ├── jquery-3.7.0.slim.min.js │ └── jquery-3.7.0.slim.min.map │ └── stylesheets │ ├── bootstrap-grid.css │ ├── bootstrap-grid.min.css │ ├── bootstrap-reboot.css │ ├── bootstrap-reboot.min.css │ ├── bootstrap.css │ ├── bootstrap.min.css │ ├── summarytools-global.css │ └── summarytools.css ├── man ├── cleartmp.Rd ├── ctable.Rd ├── define_keywords.Rd ├── descr.Rd ├── dfSummary.Rd ├── examens.Rd ├── exams.Rd ├── format_number.Rd ├── freq.Rd ├── label.Rd ├── parse_call.Rd ├── print.list.Rd ├── print.stby.Rd ├── print.summarytools.Rd ├── st_css.Rd ├── st_options.Rd ├── stby.Rd ├── summarytools-package.Rd ├── tabagisme.Rd ├── tb.Rd ├── tobacco.Rd ├── unlabel.Rd ├── use_custom_lang.Rd ├── view.Rd ├── what.is.Rd └── zap_attr.Rd ├── translations ├── en.csv ├── es.csv ├── fr.csv ├── language_template.csv ├── pt.csv ├── ru.csv ├── tr.csv └── update_translations.R └── vignettes ├── assets ├── define_keywords.png ├── dfSummary_in_RStudio_Viewer.png ├── dfSummary_md.png ├── exclamation-diamond.svg ├── lightbulb.svg └── vignette.css ├── introduction.Rmd └── rmarkdown.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^docs$ 2 | ^Meta$ 3 | ^.*\.Rproj$ 4 | ^\.Rproj\.user$ 5 | ^\.Renviron 6 | ^\.Rhistory 7 | ^\.git* 8 | ^img$ 9 | ^translations$ 10 | ^TODO.txt$ 11 | ^README.md$ 12 | ^README.Rmd$ 13 | ^tests*$ 14 | ^COPYING$ 15 | ^inst/WORDLIST$ 16 | vignettes/*.R$ 17 | vignettes/*.html$ 18 | ^doc$ 19 | ^misc$ 20 | ^tests$ 21 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | tests/ref/* linguist-detectable=false 2 | tests/ref-utf8/* linguist-detectable=false 3 | -------------------------------------------------------------------------------- /.github/workflows/check-standard.yaml.bak: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | 9 | name: R-CMD-check 10 | 11 | jobs: 12 | build: 13 | runs-on: macos-latest 14 | steps: 15 | - uses: maxim-lobanov/setup-xcode@v1 16 | with: 17 | xcode-version: latest 18 | 19 | R-CMD-check: 20 | runs-on: ${{ matrix.config.os }} 21 | 22 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 23 | 24 | strategy: 25 | fail-fast: false 26 | matrix: 27 | config: 28 | - {os: macOS-latest, r: 'release'} 29 | - {os: windows-latest, r: 'release'} 30 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 31 | - {os: ubuntu-latest, r: 'release'} 32 | - {os: ubuntu-latest, r: 'oldrel-1'} 33 | 34 | env: 35 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 36 | R_KEEP_PKG_SOURCE: yes 37 | 38 | steps: 39 | - uses: actions/checkout@v2 40 | 41 | - uses: r-lib/actions/setup-pandoc@v2 42 | 43 | - uses: r-lib/actions/setup-r@v2 44 | with: 45 | r-version: ${{ matrix.config.r }} 46 | http-user-agent: ${{ matrix.config.http-user-agent }} 47 | use-public-rspm: true 48 | 49 | - uses: r-lib/actions/setup-r-dependencies@v2 50 | with: 51 | extra-packages: any::rcmdcheck 52 | needs: check 53 | 54 | - uses: r-lib/actions/check-r-package@v2 55 | with: 56 | upload-snapshots: true 57 | -------------------------------------------------------------------------------- /.github/workflows/rhub.yaml: -------------------------------------------------------------------------------- 1 | # R-hub's generic GitHub Actions workflow file. It's canonical location is at 2 | # https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml 3 | # You can update this file to a newer version using the rhub2 package: 4 | # 5 | # rhub::rhub_setup() 6 | # 7 | # It is unlikely that you need to modify this file manually. 8 | 9 | name: R-hub 10 | run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}" 11 | 12 | on: 13 | workflow_dispatch: 14 | inputs: 15 | config: 16 | description: 'A comma separated list of R-hub platforms to use.' 17 | type: string 18 | default: 'linux,windows,macos' 19 | name: 20 | description: 'Run name. You can leave this empty now.' 21 | type: string 22 | id: 23 | description: 'Unique ID. You can leave this empty now.' 24 | type: string 25 | 26 | jobs: 27 | 28 | setup: 29 | runs-on: ubuntu-latest 30 | outputs: 31 | containers: ${{ steps.rhub-setup.outputs.containers }} 32 | platforms: ${{ steps.rhub-setup.outputs.platforms }} 33 | 34 | steps: 35 | # NO NEED TO CHECKOUT HERE 36 | - uses: r-hub/actions/setup@v1 37 | with: 38 | config: ${{ github.event.inputs.config }} 39 | id: rhub-setup 40 | 41 | linux-containers: 42 | needs: setup 43 | if: ${{ needs.setup.outputs.containers != '[]' }} 44 | runs-on: ubuntu-latest 45 | name: ${{ matrix.config.label }} 46 | strategy: 47 | fail-fast: false 48 | matrix: 49 | config: ${{ fromJson(needs.setup.outputs.containers) }} 50 | container: 51 | image: ${{ matrix.config.container }} 52 | 53 | steps: 54 | - uses: r-hub/actions/checkout@v1 55 | - uses: r-hub/actions/platform-info@v1 56 | with: 57 | token: ${{ secrets.RHUB_TOKEN }} 58 | job-config: ${{ matrix.config.job-config }} 59 | - uses: r-hub/actions/setup-deps@v1 60 | with: 61 | token: ${{ secrets.RHUB_TOKEN }} 62 | job-config: ${{ matrix.config.job-config }} 63 | - uses: r-hub/actions/run-check@v1 64 | with: 65 | token: ${{ secrets.RHUB_TOKEN }} 66 | job-config: ${{ matrix.config.job-config }} 67 | 68 | other-platforms: 69 | needs: setup 70 | if: ${{ needs.setup.outputs.platforms != '[]' }} 71 | runs-on: ${{ matrix.config.os }} 72 | name: ${{ matrix.config.label }} 73 | strategy: 74 | fail-fast: false 75 | matrix: 76 | config: ${{ fromJson(needs.setup.outputs.platforms) }} 77 | 78 | steps: 79 | - uses: r-hub/actions/checkout@v1 80 | - uses: r-hub/actions/setup-r@v1 81 | with: 82 | job-config: ${{ matrix.config.job-config }} 83 | token: ${{ secrets.RHUB_TOKEN }} 84 | - uses: r-hub/actions/platform-info@v1 85 | with: 86 | token: ${{ secrets.RHUB_TOKEN }} 87 | job-config: ${{ matrix.config.job-config }} 88 | - uses: r-hub/actions/setup-deps@v1 89 | with: 90 | job-config: ${{ matrix.config.job-config }} 91 | token: ${{ secrets.RHUB_TOKEN }} 92 | - uses: r-hub/actions/run-check@v1 93 | with: 94 | job-config: ${{ matrix.config.job-config }} 95 | token: ${{ secrets.RHUB_TOKEN }} 96 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Meta 2 | .Rprofile 3 | .Rhistory 4 | .Renviron 5 | summarytools.Rproj 6 | .Rproj.user 7 | TODO.txt 8 | tests/* 9 | img/ds*.png 10 | vignettes/*.R 11 | notes/ 12 | inst/doc 13 | inst/includes/win_includes 14 | inst/includes/linux_includes 15 | /Meta/ 16 | /doc/ 17 | /lua/ 18 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: summarytools 2 | Type: Package 3 | Title: Tools to Quickly and Neatly Summarize Data 4 | Version: 1.1.4 5 | Authors@R: person("Dominic", "Comtois", email = "dominic.comtois@gmail.com", 6 | role = c("aut", "cre")) 7 | Author: Dominic Comtois [aut, cre] 8 | Maintainer: Dominic Comtois 9 | Language: en-US 10 | Description: Data frame summaries, cross-tabulations, 11 | weight-enabled frequency tables and common descriptive 12 | (univariate) statistics in concise tables available in a 13 | variety of formats (plain ASCII, Markdown and HTML). A good 14 | point-of-entry for exploring data, both for experienced 15 | and new R users. 16 | Imports: 17 | base64enc, 18 | checkmate, 19 | dplyr, 20 | grDevices, 21 | htmltools, 22 | lubridate, 23 | magick, 24 | matrixStats, 25 | methods, 26 | pander, 27 | pryr, 28 | rapportools, 29 | stats, 30 | tcltk, 31 | tibble, 32 | tidyr, 33 | utils 34 | Suggests: 35 | forcats, 36 | formatR, 37 | haven, 38 | kableExtra, 39 | knitr, 40 | magrittr, 41 | rmarkdown, 42 | rstudioapi, 43 | backports 44 | Depends: R (>= 3.5) 45 | VignetteBuilder: knitr 46 | LazyData: true 47 | License: GPL-2 48 | URL: https://github.com/dcomtois/summarytools 49 | BugReports: https://github.com/dcomtois/summarytools/issues 50 | Encoding: UTF-8 51 | RoxygenNote: 7.3.2 52 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(descr,default) 4 | S3method(descr,grouped_df) 5 | S3method(print,list) 6 | S3method(print,stby) 7 | S3method(print,summarytools) 8 | S3method(tb,by) 9 | S3method(tb,default) 10 | S3method(tb,list) 11 | S3method(tb,stby) 12 | S3method(tb,summarytools) 13 | export("label<-") 14 | export(cleartmp) 15 | export(ctable) 16 | export(define_keywords) 17 | export(descr) 18 | export(dfSummary) 19 | export(freq) 20 | export(label) 21 | export(llabel) 22 | export(st_css) 23 | export(st_options) 24 | export(stby) 25 | export(stview) 26 | export(tb) 27 | export(unlabel) 28 | export(use_custom_lang) 29 | export(view) 30 | export(what.is) 31 | export(zap_attr) 32 | import(htmltools) 33 | importFrom(base64enc,base64encode) 34 | importFrom(checkmate,anyNaN) 35 | importFrom(checkmate,check_file_exists) 36 | importFrom(checkmate,check_path_for_output) 37 | importFrom(checkmate,test_character) 38 | importFrom(checkmate,test_choice) 39 | importFrom(checkmate,test_file_exists) 40 | importFrom(checkmate,test_int) 41 | importFrom(checkmate,test_logical) 42 | importFrom(checkmate,test_number) 43 | importFrom(checkmate,test_path_for_output) 44 | importFrom(checkmate,test_string) 45 | importFrom(dplyr,"%>%") 46 | importFrom(dplyr,bind_cols) 47 | importFrom(dplyr,bind_rows) 48 | importFrom(dplyr,group_keys) 49 | importFrom(dplyr,group_vars) 50 | importFrom(dplyr,n) 51 | importFrom(dplyr,n_distinct) 52 | importFrom(dplyr,select) 53 | importFrom(dplyr,starts_with) 54 | importFrom(dplyr,summarise_all) 55 | importFrom(grDevices,dev.list) 56 | importFrom(grDevices,dev.off) 57 | importFrom(grDevices,nclass.Sturges) 58 | importFrom(grDevices,png) 59 | importFrom(graphics,barplot) 60 | importFrom(graphics,hist) 61 | importFrom(graphics,par) 62 | importFrom(graphics,plot.new) 63 | importFrom(graphics,text) 64 | importFrom(lubridate,as.period) 65 | importFrom(lubridate,interval) 66 | importFrom(lubridate,is.Date) 67 | importFrom(magick,image_border) 68 | importFrom(magick,image_read) 69 | importFrom(magick,image_transparent) 70 | importFrom(magick,image_trim) 71 | importFrom(magick,image_write) 72 | importFrom(matrixStats,weightedMad) 73 | importFrom(matrixStats,weightedMean) 74 | importFrom(matrixStats,weightedMedian) 75 | importFrom(matrixStats,weightedSd) 76 | importFrom(methods,is) 77 | importFrom(pander,pander) 78 | importFrom(pander,panderOptions) 79 | importFrom(pryr,ftype) 80 | importFrom(pryr,otype) 81 | importFrom(pryr,standardise_call) 82 | importFrom(pryr,where) 83 | importFrom(rapportools,kurtosis) 84 | importFrom(rapportools,nvalid) 85 | importFrom(rapportools,skewness) 86 | importFrom(stats,IQR) 87 | importFrom(stats,addmargins) 88 | importFrom(stats,chisq.test) 89 | importFrom(stats,end) 90 | importFrom(stats,ftable) 91 | importFrom(stats,mad) 92 | importFrom(stats,median) 93 | importFrom(stats,na.omit) 94 | importFrom(stats,qnorm) 95 | importFrom(stats,quantile) 96 | importFrom(stats,sd) 97 | importFrom(stats,start) 98 | importFrom(stats,xtabs) 99 | importFrom(tcltk,tclvalue) 100 | importFrom(tcltk,tk_messageBox) 101 | importFrom(tcltk,tkgetOpenFile) 102 | importFrom(tcltk,tkgetSaveFile) 103 | importFrom(tibble,as_tibble) 104 | importFrom(tibble,tibble) 105 | importFrom(tidyr,gather) 106 | importFrom(tidyr,separate) 107 | importFrom(tidyr,spread) 108 | importFrom(utils,capture.output) 109 | importFrom(utils,data) 110 | importFrom(utils,edit) 111 | importFrom(utils,head) 112 | importFrom(utils,methods) 113 | importFrom(utils,object.size) 114 | importFrom(utils,packageDescription) 115 | importFrom(utils,packageVersion) 116 | importFrom(utils,read.csv) 117 | importFrom(utils,read.delim) 118 | importFrom(utils,setTxtProgressBar) 119 | importFrom(utils,tail) 120 | importFrom(utils,txtProgressBar) 121 | importFrom(utils,write.csv) 122 | -------------------------------------------------------------------------------- /R/cleartmp.R: -------------------------------------------------------------------------------- 1 | #' Delete Temporary Html Files 2 | #' 3 | #' Delete temporary files created when using generic print method with 4 | #' \code{method='browser'} or \code{method='viewer'}, or when calling 5 | #' \code{view()} function. 6 | #' 7 | #' @param all Logical. When \code{TRUE} (default), all temporary summarytools 8 | #' files are deleted. When \code{FALSE}, only the latest file is. 9 | #' @param silent Logical. Hide confirmation messages (\code{FALSE} by default). 10 | #' @param verbose Logical. Display a message for every file that is deleted. 11 | #' \code{FALSE} by default. 12 | #' 13 | #' @return NULL 14 | #' 15 | #' @note Given that all temporary files are deleted automatically when an R 16 | #' session is ended, this function is an overkill in most circumstances. It 17 | #' could however be useful in server-type setups. 18 | #' 19 | #' @author Dominic Comtois, \email{dominic.comtois@@gmail.com} 20 | #' 21 | #' @keywords IO 22 | #' 23 | #' @export 24 | #' @importFrom utils tail 25 | cleartmp <- function(all=TRUE, silent = FALSE, verbose = FALSE) { 26 | if (length(.st_env$tmpfiles) == 0) { 27 | if (!silent) 28 | message("No temporary files to delete.") 29 | } else if (isTRUE(all) || all == 1 || all == "all") { 30 | nfiles <- 0 31 | for (tmpfile in .st_env$tmpfiles) { 32 | nfiles <- nfiles + 1 33 | if (isTRUE(verbose)) 34 | message(paste("Deleting", tmpfile)) 35 | unlink(tmpfile) 36 | } 37 | .st_env$tmpfiles <- c() 38 | if (!isTRUE(silent)) 39 | message(paste(nfiles, "file(s) deleted")) 40 | } else { 41 | tmpfile <- tail(.st_env$tmpfiles, 1) 42 | if (!isTRUE(silent)) 43 | message(paste("Deleting", tmpfile)) 44 | unlink(tmpfile) 45 | length(.st_env$tmpfiles) <- length(.st_env$tmpfiles) - 1 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /R/examens.R: -------------------------------------------------------------------------------- 1 | #' Bulletin de notes (donnees simulees) 2 | #' 3 | #' Jeu de donnees simulees contenant les notes de 30 etudiants, avec les 4 | #' colonnes suivantes: 5 | #' \itemize{ 6 | #' \item etudiant Nom de l'etudiant. 7 | #' \item sexe Variable categorielle (facteur). Deux niveaux: \dQuote{Fille}, 8 | #' \dQuote{Garcon}. 9 | #' \item francais Note en francais (numerique). 10 | #' \item math Note en maths (numerique). 11 | #' \item geographie Note en geographie (numerique). 12 | #' \item histoire Note en histoire (numerique). 13 | #' \item economie Note en economie (numerique). 14 | #' \item anglais Note en anglais (numerique). 15 | #' } 16 | #' 17 | #' Donnees simulees. Les notes de chaque etudiant sont centrees autour d'une 18 | #' moyenne personnelle et ecart-type randomises. 19 | #' 20 | #' A copy of this dataset is \strong{available in English} under the name 21 | #' \dQuote{exams}. 22 | #' 23 | #' @docType data 24 | #' @keywords datasets 25 | #' @name examens 26 | #' @usage data(examens) 27 | #' @format Un data frame de 30 rangees et 8 colonnes 28 | NULL 29 | -------------------------------------------------------------------------------- /R/exams.R: -------------------------------------------------------------------------------- 1 | #' Report Cards - Simulated Data 2 | #' 3 | #' A simulated dataset with grades for hypothetical 30 students, with 4 | #' the following variables: 5 | #' \itemize{ 6 | #' \item student Student's name. 7 | #' \item gender Factor with 2 levels: \dQuote{Girl}, \dQuote{Boy}. 8 | #' \item french French Grade (numerical). 9 | #' \item math Math Grade (numerical). 10 | #' \item geography Geography Grade (numerical). 11 | #' \item history History Grade (numerical). 12 | #' \item economics Economics Grade (numerical). 13 | #' \item english English Grade (numerical). 14 | #' } 15 | #' 16 | #' All names and grades are simulated. Grades for each student are centered 17 | #' around a personal randomized average and standard deviation. 18 | #' 19 | #' A copy of this dataset is also \strong{available in French} under 20 | #' the name \dQuote{examens}. 21 | #' 22 | #' @docType data 23 | #' @keywords datasets 24 | #' @name exams 25 | #' @usage data(exams) 26 | #' @format A data frame with 30 rows and 8 variables 27 | NULL 28 | -------------------------------------------------------------------------------- /R/label.R: -------------------------------------------------------------------------------- 1 | #' Get or Set Variable or Data Frame Labels 2 | #' 3 | #' Assigns a label to a vector or data frame, or returns value stored 4 | #' in the object's \code{label} attribute (or \code{NA} if none exists). 5 | #' 6 | #' @aliases label label<- llabel 7 | #' @usage 8 | #' label(x, all = FALSE, fallback = FALSE, simplify = FALSE) 9 | #' label(x) <- value 10 | #' llabel(x, all = TRUE, fallback = FALSE, simplify = FALSE) 11 | #' 12 | #' @param x An R object to extract labels from. 13 | #' @param all Logical. When x is a data frame, setting this argument to 14 | #' \code{TRUE} will make the function return all variable labels. By 15 | #' default, its value is \code{FALSE}, so that if x is a data frame, it is 16 | #' the data frame's label itself that will be returned. 17 | #' @param fallback a logical value indicating if labels (returned values) 18 | #' should fallback to object name(s). Defaults to \code{FALSE}. 19 | #' @param simplify When x is a data frame and \code{all = TRUE}, coerce 20 | #' results to a vector and remove \code{NA}'s. Default is \code{FALSE}. 21 | #' @param value String to be used as label. To clear existing labels, use 22 | #' \code{NA} or \code{NULL}. 23 | #' 24 | #' @returns A single character vector if \code{all = FALSE} (default), 25 | #' or a named list if \code{all = TRUE} (named vector when using 26 | #' \code{simplify = TRUE}. 27 | #' 28 | #' @details 29 | #' The wrapper function \code{llabel} was named that way to avoid conflicting 30 | #' with base function \code{\link[base]{labels}}. 31 | #' 32 | #' @author 33 | #' Dominic Comtois, \email{dominic.comtois@@gmail.com}, 34 | #' @note Loosely based on Gergely Daróczi's \code{\link[rapportools]{label}} 35 | #' function. 36 | #' @export 37 | #' @importFrom utils tail 38 | label <- function(x, all = FALSE, fallback = FALSE, simplify = FALSE) { 39 | 40 | if (missing(x)) 41 | stop("No variable / data frame provided.") 42 | 43 | if (is.null(x)) 44 | stop("cannot extract label from NULL") 45 | 46 | if (is.atomic(x)) { 47 | lbl <- attr(x, which = "label", exact = TRUE) 48 | if (is.null(lbl)) { 49 | if (isTRUE(fallback)) { 50 | lbl <- tail(as.character(substitute(x)), 1) 51 | } else { 52 | lbl <- NA_character_ 53 | } 54 | } 55 | } else { 56 | if (!is.list(x)) { 57 | x <- as.data.frame(x) 58 | } 59 | 60 | if (isTRUE(all)) { 61 | lbl <- lapply(x, attr, which = "label", exact = TRUE) 62 | lbl[which(vapply(X = lbl, FUN = is.null, FUN.VALUE = logical(1)))] <- 63 | NA_character_ 64 | 65 | if (isTRUE(fallback)) { 66 | lbl[which(is.na(lbl))] <- colnames(x)[which(is.na(lbl))] 67 | } 68 | if (isTRUE(simplify)) { 69 | lbl <- as.character(lbl) 70 | } else { 71 | lbl <- lbl[which(!is.na(lbl))] 72 | } 73 | } else { 74 | lbl <- attr(x, which = "label", exact = TRUE) 75 | if (is.null(lbl)) { 76 | if (isTRUE(fallback)) { 77 | lbl <- tail(as.character(substitute(x)), 1) 78 | } else { 79 | lbl <- NA_character_ 80 | } 81 | } 82 | } 83 | } 84 | 85 | return(lbl) 86 | } 87 | 88 | #' @export 89 | "label<-" <- function(x, value) { 90 | 91 | if (missing(x) || missing(value)) 92 | stop("Both x and value arguments must be provided") 93 | 94 | if (is.null(value)) 95 | value <- NA 96 | 97 | if (is.data.frame(x)) { 98 | if (length(value) > 1 && length(value) < ncol(x)) 99 | stop("Number of labels does not match number of columns in x") 100 | 101 | if (length(value) == 1 && is.na(value)) { 102 | attr(x, "label") <- NULL 103 | } else if (length(value) == 1) { 104 | attr(x, "label") <- value 105 | } else if (length(value) == ncol(x)) { 106 | for (i in seq_along(value)) { 107 | attr(x[[i]], "label") <- value[i] 108 | } 109 | } else { 110 | stop(paste("provide a single string to label the data frame, or a vector", 111 | "of characters having length = ncol(x)")) 112 | } 113 | } else if (is.atomic(x)) { 114 | if (is.na(value)) { 115 | attr(x, "label") <- NULL 116 | } else if (length(value) > 1) { 117 | stop("A variable label must be a character vector of length 1") 118 | } else { 119 | attr(x, "label") <- value 120 | } 121 | } 122 | return(x) 123 | } 124 | 125 | #' @usage 126 | #' llabel(x, all = TRUE, fallback = FALSE, simplify = FALSE) 127 | #' @export 128 | llabel <- function(x, all = TRUE, fallback = FALSE, simplify = FALSE) { 129 | label(x, all = all, fallback = fallback, simplify = simplify) 130 | } 131 | 132 | #' Clear Variable and Data Frame Label(s) 133 | #' 134 | #' Returns the object with all labels removed. The \dQuote{label} attribute 135 | #' as well as the \dQuote{labelled} class (used by Hmisc and labelled) are 136 | #' cleared. 137 | #' 138 | #' @usage unlabel(x) 139 | #' @param x An R object to remove labels from. 140 | #' @seealso \code{\link{label}} 141 | #' @author 142 | #' Dominic Comtois, \email{dominic.comtois@@gmail.com}, 143 | #' @export 144 | unlabel <- function(x) { 145 | if (is.list(x)) { 146 | for (i in seq_along(x)) { 147 | class(x[[i]]) <- setdiff(class(x[[i]]), "labelled") 148 | } 149 | for (i in seq_along(x)) { 150 | attr(x[[i]],"label") <- NULL 151 | } 152 | } 153 | else { 154 | class(x) <- setdiff(class(x), "labelled") 155 | attr(x, "label") <- NULL 156 | } 157 | return(x) 158 | } 159 | -------------------------------------------------------------------------------- /R/print.list.R: -------------------------------------------------------------------------------- 1 | #' Print Method for Objects of Class \dQuote{list} 2 | #' 3 | #' Displays a list comprised of summarytools objects created with 4 | #' \code{\link{lapply}}. 5 | #' 6 | #' @usage 7 | #' \method{print}{list}(x, method = "pander", file = "", 8 | #' append = FALSE, report.title = NA, table.classes = NA, 9 | #' bootstrap.css = st_options('bootstrap.css'), 10 | #' custom.css = st_options('custom.css'), silent = FALSE, 11 | #' footnote = st_options('footnote'), collapse = 0, 12 | #' escape.pipe = st_options('escape.pipe'), \dots) 13 | #' 14 | #' @details This function is there only for cases where the object to be printed 15 | #' was created with \code{\link{lapply}}, as opposed to the recommended 16 | #' functions for creating grouped results (\code{\link{stby}} and 17 | #' \code{\link[dplyr]{group_by}}). 18 | #' 19 | #' @inheritParams print.summarytools 20 | #' @method print list 21 | #' @export 22 | print.list <- function(x, 23 | method = "pander", 24 | file = "", 25 | append = FALSE, 26 | report.title = NA, 27 | table.classes = NA, 28 | bootstrap.css = st_options("bootstrap.css"), 29 | custom.css = st_options("custom.css"), 30 | silent = FALSE, 31 | footnote = st_options("footnote"), 32 | collapse = 0, 33 | escape.pipe = st_options("escape.pipe"), 34 | ...) { 35 | 36 | if (length(x) > 0 && inherits(x[[1]], "summarytools")) { 37 | 38 | view(x, 39 | method = method, 40 | file = file, 41 | append = append, 42 | report.title = report.title, 43 | table.classes = table.classes, 44 | bootstrap.css = bootstrap.css, 45 | custom.css = custom.css, 46 | silent = silent, 47 | footnote = footnote, 48 | collapse = collapse, 49 | escape.pipe = escape.pipe, 50 | ...) 51 | 52 | } else { 53 | NextMethod("print", x) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /R/print.stby.R: -------------------------------------------------------------------------------- 1 | #' Print Method for Objects of Class \dQuote{stby} 2 | #' 3 | #' Displays a list comprised of summarytools objects created with \code{stby}. 4 | #' 5 | #' @usage 6 | #' \method{print}{stby}(x, method = "pander", file = "", 7 | #' append = FALSE, report.title = NA, table.classes = NA, 8 | #' bootstrap.css = st_options('bootstrap.css'), 9 | #' custom.css = st_options('custom.css'), silent = FALSE, 10 | #' footnote = st_options('footnote'), 11 | #' escape.pipe = st_options('escape.pipe'), \dots) 12 | #' 13 | #' @inheritParams print.summarytools 14 | #' @method print stby 15 | #' @export 16 | print.stby <- function(x, 17 | method = "pander", 18 | file = "", 19 | append = FALSE, 20 | report.title = NA, 21 | table.classes = NA, 22 | bootstrap.css = st_options("bootstrap.css"), 23 | custom.css = st_options("custom.css"), 24 | silent = FALSE, 25 | footnote = st_options("footnote"), 26 | escape.pipe = st_options("escape.pipe"), 27 | ...) { 28 | 29 | # Special case of nested lists (by() / stby() used with freq(), 2+ vars) 30 | if (!"silent" %in% names(match.call())) { 31 | if (!"st_type" %in% names(attributes(x[[1]])) && is.list(x[[1]])) 32 | silent <- st_options(paste0(attr(x[[1]][[1]], "st_type"), ".silent")) 33 | else 34 | silent <- st_options(paste0(attr(x[[1]], "st_type"), ".silent")) 35 | } 36 | 37 | view(x, 38 | method = method, 39 | file = file, 40 | append = append, 41 | report.title = report.title, 42 | table.classes = table.classes, 43 | bootstrap.css = bootstrap.css, 44 | custom.css = custom.css, 45 | silent = silent, 46 | footnote = footnote, 47 | escape.pipe = escape.pipe, 48 | ...) 49 | } 50 | -------------------------------------------------------------------------------- /R/st_css.R: -------------------------------------------------------------------------------- 1 | #' Include \strong{summarytools}' \emph{css} Into Active Document 2 | #' 3 | #' Generate the \emph{css} needed by \strong{summarytools} in \emph{html} 4 | #' documents. 5 | #' 6 | #' @param main Logical. Include \emph{summarytools.css} file. \code{TRUE} by 7 | #' default. This will affects only \strong{summarytools} objects, for one 8 | #' exception: two properties of the \code{img} tag are redefined to have 9 | #' \code{background-color: transparent} and \code{border: 0}. 10 | #' @param global Logical. Include the additional \emph{summarytools-global.css} 11 | #' file, which affects all content in the document. Provides control over 12 | #' objects that were not \emph{html-rendered}; in particular, table widths 13 | #' and vertical alignment are modified to improve layout. \code{FALSE} by 14 | #' default. 15 | #' @param bootstrap Logical. Include \emph{bootstrap.min.css}. \code{FALSE} 16 | #' by default. 17 | #' @param style.tag Logical. Include the opening and closing \code{\n' 68 | } 69 | 70 | output <- paste(output, sep = "\n") 71 | cat(output) 72 | return(invisible(output)) 73 | } 74 | -------------------------------------------------------------------------------- /R/stby.R: -------------------------------------------------------------------------------- 1 | #' Obtain Grouped Statistics With summarytools 2 | #' 3 | #' An adaptation base R's \code{\link{by}} function, designed to 4 | #' optimize the results' display. 5 | #' 6 | #' @param data an R object, normally a data frame, possibly a matrix. 7 | #' @param INDICES a grouping variable or a list of grouping variables, 8 | #' each of length \code{nrow(data)}. 9 | #' @param FUN a function to be applied to (usually data-frame) subsets of data. 10 | #' @param \dots Further arguments to FUN. 11 | #' @param useNA Make NA a valid grouping value in INDICES variable(s). 12 | #' Set to \code{FALSE} explicitly to eliminate message. 13 | #' 14 | #' @return An object of classes \dQuote{list} and \dQuote{summarytools}, 15 | #' giving results for each subset. 16 | #' 17 | #' @details When the grouping variable(s) contain NA values, the 18 | #' \code{base::\link[base]{by}} function (as well as summarytools 19 | #' versions prior to 1.1.0) ignores corresponding groups. Version 1.1.0 20 | #' allows setting \code{useNA = TRUE} to make new groups using 21 | #' NA values on the grouping variable(s), just as 22 | #' \code{dplyr::\link[dplyr]{group_by}} does. 23 | #' 24 | #' When NA values are detected and \code{useNA = FALSE}, a message is 25 | #' displayed; to disable this message, set \code{check.nas = FALSE}. 26 | #' 27 | #' @examples 28 | #' data("tobacco") 29 | #' with(tobacco, stby(data = BMI, INDICES = gender, FUN = descr, 30 | #' check.nas = FALSE)) 31 | #' with(tobacco, stby(data = smoker, INDICES = gender, freq, useNA = TRUE)) 32 | #' with(tobacco, stby(data = list(x = smoker, y = diseased), 33 | #' INDICES = gender, FUN = ctable, useNA = TRUE)) 34 | #' 35 | #' @seealso \code{\link[base]{by}}, \code{\link[dplyr]{group_by}} 36 | #' @keywords utilities 37 | #' @importFrom tibble as_tibble 38 | #' @export 39 | stby <- function(data, INDICES, FUN, ..., useNA = FALSE) { 40 | .p_reset() 41 | # Check that FUN is a summarytools function 42 | mc <- match.call() 43 | 44 | if (!"FUN" %in% names(mc)) 45 | stop("FUN argument is missing in call to stby()") 46 | 47 | if (!is.function(FUN)) 48 | stop(paste(mc$FUN, "is not a function")) 49 | 50 | dd <- as.data.frame(data) 51 | 52 | if (identical(FUN, summarytools::freq) && ncol(dd) > 1) 53 | stop("when using freq() with stby(), only one variable may be analysed;", 54 | "if only basic console output is needed, use by()") 55 | 56 | if (!is.list(INDICES)) { 57 | IND <- vector("list", 1L) 58 | IND[[1L]] <- INDICES 59 | names(IND) <- deparse(substitute(INDICES))[1L] 60 | } else { 61 | IND <- INDICES 62 | } 63 | 64 | # Store original class & levels to restore later on 65 | IND_orig_class <- lapply(IND, class) 66 | IND_orig_levels <- vector("list", length(IND)) 67 | IND_orig_attr <- lapply(IND, attributes) 68 | 69 | for (i in seq_along(IND)) { 70 | if (is.factor(IND[[i]])) { 71 | IND_orig_levels[[i]] <- levels(IND[[i]]) 72 | } 73 | } 74 | 75 | if (isTRUE(useNA)) { 76 | for (i in seq_along(IND)) { 77 | if (anyNA(IND[[i]])) { 78 | if (!inherits(IND[[i]], c("character", "factor"))) { 79 | IND[[i]] <- as.factor(IND[[i]]) 80 | } 81 | IND[[i]] <- forcats::fct_na_value_to_level(IND[[i]], "NA") 82 | } 83 | } 84 | } else if (missing(useNA)) { 85 | if (any(sapply(IND, anyNA))) 86 | message(paste("NA detected in grouping variable(s); consider using", 87 | "useNA = TRUE")) 88 | } 89 | 90 | FUNx <- function(x) FUN(dd[x, , drop = FALSE], ...) 91 | nd <- nrow(dd) 92 | res <- structure(eval(substitute(tapply(seq_len(nd), IND, FUNx, 93 | simplify = TRUE)), dd), 94 | call = match.call(), class = "stby") 95 | 96 | # add groups attribute 97 | groups <- as_tibble( 98 | expand.grid( 99 | attr(res, "dimnames"), 100 | stringsAsFactors = FALSE, KEEP.OUT.ATTRS = FALSE 101 | ), .name_repair = "minimal") 102 | 103 | # remove df names if present (zzz$abc --> abc) 104 | colnames(groups) <- sub(".+\\$", "", colnames(groups)) 105 | names(dimnames(res)) <- sub(".+\\$", "", names(dimnames(res))) 106 | 107 | # Replace "NA" with actual NA to restore original classes 108 | if (isTRUE(useNA)) { 109 | for (col in seq_along(groups)) { 110 | groups[[col]][groups[[col]] == "NA"] <- NA 111 | } 112 | } 113 | 114 | # Try to restore original classes & attributes 115 | for (i in seq_along(groups)) { 116 | if (!identical(class(groups[[i]]), IND_orig_class[[i]])) { 117 | if ("factor" %in% IND_orig_class[[i]]) { 118 | try(groups[[i]] <- factor(groups[[i]], levels = IND_orig_levels[[i]], 119 | ordered = "ordered" %in% IND_orig_class[[i]]), 120 | silent = TRUE) 121 | } else if ("Date" %in% IND_orig_class[[i]]) { 122 | try(groups[[i]] <- as.Date(groups[[i]]), silent = TRUE) 123 | } else if ("POSIXct" %in% IND_orig_class[[i]]) { 124 | if ("tzone" %in% names(IND_orig_attr[[i]])) { 125 | try(groups[[i]] <- as.POSIXct(groups[[i]], 126 | tz = IND_orig_attr[[i]]$tzone), 127 | silent = TRUE) 128 | } else { 129 | try(groups[[i]] <- as.POSIXct(groups[[i]]), silent = TRUE) 130 | } 131 | } else { 132 | safe_copy <- groups[[i]] 133 | try({ 134 | attributes(groups[[i]]) <- IND_orig_attr[[i]] 135 | class(groups[[i]]) <- IND_orig_class[[i]] 136 | }, silent = TRUE) 137 | 138 | if (sum(is.na(groups[[i]])) != sum(is.na(safe_copy))) { 139 | groups[[i]] <- safe_copy 140 | } 141 | } 142 | } 143 | } 144 | 145 | # remove NULL elements (has side-effect of removing dim and dimnames) 146 | non_null_ind <- which(!vapply(res, is.null, logical(1))) 147 | if (length(non_null_ind) < length(res)) { 148 | atr <- attributes(res) 149 | res <- res[non_null_ind] 150 | attributes(res) <- atr[c("call", "class")] 151 | groups <- groups[non_null_ind,] 152 | } 153 | 154 | # Set useNA as attribute; to be used by tb() 155 | attr(res, "useNA") <- useNA 156 | attr(res, "groups") <- groups 157 | 158 | # set names 159 | if (ncol(groups) == 1 && length(res) == length(groups[[1]])) { 160 | names(res) <- groups[[1]] 161 | } else { 162 | names(res) <- vapply(res, function(gr) attr(gr, "data_info")$Group, 163 | character(1)) 164 | } 165 | 166 | return(res) 167 | } 168 | -------------------------------------------------------------------------------- /R/summarytools.R: -------------------------------------------------------------------------------- 1 | #' Tools to Quickly and Neatly Summarize Data 2 | #' 3 | #' \pkg{summarytools} is a collection of functions which neatly and quickly 4 | #' summarize numerical and categorical data. Data frame summaries, frequency 5 | #' tables and cross-tabulations, as well as common descriptive (univariate) 6 | #' statistics can be produced in a straightforward manner. Users with little to 7 | #' no prior R programming experience but who are familiar with popular commercial 8 | #' statistical software such as SAS, SPSS and Stata will feel right at home. 9 | #' 10 | #' These are the four core functions: 11 | #' \describe{ 12 | #' \item{dfSummary}{Extensive yet legible data frame summaries.} 13 | #' \item{freq}{Frequency tables supporting weights and displaying proportions 14 | #' of valid and of total data, including cumulative proportions.} 15 | #' \item{descr}{All common univariate descriptive stats applied to a single 16 | #' vector or to all numerical vectors contained in a data frame.} 17 | #' \item{ctable}{Cross-tabulations for pairs of categorical variables -- 18 | #' accepting both numerical and character vectors, as well as factors. 19 | #' Choose between \emph{Total}, \emph{Columns} or \emph{Rows} proportions, 20 | #' and optionally display chi-square statistic (with corresponding p-value), 21 | #' odds ratio, as well as risk ratio with flexible confidence intervals.} 22 | #' } 23 | #' 24 | #' \strong{Choice of output formats}: 25 | #' \describe{ 26 | #' \item{plain ascii}{Ideal when showing results in the R console.} 27 | #' \item{rmarkdown}{Perfect for writing short papers or presentations.} 28 | #' \item{html}{A format very well integrated in \emph{RStudio} -- but will 29 | #' work with any Web browser. Use the \code{\link{view}} function to display 30 | #' results directly in \emph{RStudio}'s viewer, or in your preferred Web 31 | #' browser.} 32 | #' } 33 | #' 34 | "_PACKAGE" 35 | -------------------------------------------------------------------------------- /R/sysdata.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/R/sysdata.rda -------------------------------------------------------------------------------- /R/tabagisme.R: -------------------------------------------------------------------------------- 1 | #' Usage du tabac et etat de sante (donnees simulees) 2 | #' 3 | #' Jeu de donnees simulees de 1000 sujets, avec les 4 | #' colonnes suivantes: 5 | #' \itemize{ 6 | #' \item sexe Variable categorielle (facteur), 2 niveaux: 7 | #' \dQuote{F} et \dQuote{M}. Environ 500 chacun. 8 | #' \item age Numerique. 9 | #' \item age.gr Groupe d'age - variable categorielle, 4 niveaux. 10 | #' \item IMC Indice de masse corporelle (numerique). 11 | #' \item fumeur Variable categorielle, 2 niveaux 12 | #' (\dQuote{Oui} / \dQuote{Non}). 13 | #' \item cigs.par.jour Nombre de cigarettes fumees par jour 14 | #' (numerique). 15 | #' \item malade Variable categorielle, 2 niveaux 16 | #' (\dQuote{Oui} / \dQuote{Non}). 17 | #' \item maladie Champs texte. 18 | #' \item ponderation Poids echantillonal (numerique). 19 | #' } 20 | #' 21 | #' Note sur la simulation des donnees: la probabilite pour 22 | #' un sujet de tomber dans la categorie \dQuote{malade} est 23 | #' basee sur une fonction arbitraire faisant intervenir l'age, 24 | #' l'IMC et le nombre de cigarettes fumees par jour. 25 | #' 26 | #' A copy of this dataset is \strong{available in English} under the name 27 | #' \dQuote{tobacco}. 28 | #' 29 | #' @docType data 30 | #' @keywords datasets 31 | #' @name tabagisme 32 | #' @usage data(tabagisme) 33 | #' @format Un data frame de 1000 rangees et 9 colonnes 34 | NULL 35 | -------------------------------------------------------------------------------- /R/tobacco.R: -------------------------------------------------------------------------------- 1 | #' Tobacco Use and Health - Simulated Dataset 2 | #' 3 | #' A simulated datasets of 1,000 subjects, with the following variables: 4 | #' 5 | #' \itemize{ 6 | #' \item gender Factor with 2 levels: \dQuote{F} and \dQuote{M}, having 7 | #' roughly 500 of each. 8 | #' \item age Numerical. 9 | #' \item age.gr Factor with 4 age categories. 10 | #' \item BMI Body Mass Index (numerical). 11 | #' \item smoker Factor (\dQuote{Yes} / \dQuote{No}). 12 | #' \item cigs.per.day Number of cigarettes smoked per day 13 | #' (numerical). 14 | #' \item diseased Factor (\dQuote{Yes} / \dQuote{No}). 15 | #' \item disease Character. 16 | #' \item samp.wgts Sampling weights (numerical). 17 | #' } 18 | #' 19 | #' A note on simulation: probability for an individual to fall into 20 | #' category \dQuote{diseased} is based on an arbitrary function 21 | #' involving age, BMI and number of cigarettes per day. 22 | #' 23 | #' A copy of this dataset is also \strong{available in French} under 24 | #' the name \dQuote{tabagisme}. 25 | #' 26 | #' @docType data 27 | #' @keywords datasets 28 | #' @name tobacco 29 | #' @usage data(tobacco) 30 | #' @format A data frame with 1000 rows and 9 variables 31 | NULL 32 | -------------------------------------------------------------------------------- /R/use_custom_lang.R: -------------------------------------------------------------------------------- 1 | #' Import and use a custom language 2 | #' 3 | #' If your language is not available or if you wish to customize the outputs' 4 | #' language to suit your preference, you can set up a translations file (see 5 | #' details) and import it with this function. 6 | #' @aliases use_custom_lang 7 | #' 8 | #' @param file Character. The path to the translations file. 9 | #' 10 | #' @details To build the translations file, copy the 11 | #' \emph{language_template.csv} file located in the installed 12 | #' package's \emph{includes} directory and fill out the \sQuote{custom} column 13 | #' using a text editor, leaving column titles unchanged. The file must also 14 | #' retain its \emph{UTF-8} encoding. 15 | #' 16 | #' @keywords utilities 17 | #' @importFrom utils read.csv 18 | #' @importFrom tcltk tclvalue tkgetOpenFile 19 | #' @export 20 | use_custom_lang <- function(file) { 21 | 22 | if (!"file" %in% names(match.call())) { 23 | if (interactive() && isTRUE(capabilities("tcltk"))) { 24 | file <- character() 25 | file <- try(tclvalue(tkgetOpenFile(initialdir = "~", 26 | filetypes = "{{csv files} {*.csv}}")), 27 | silent = TRUE) 28 | if (inherits(file, "try-error")) { 29 | stop("Window dialog not permitted; 'file' argument must be specified") 30 | } 31 | if (file == "") { 32 | stop("operation cancelled") 33 | } 34 | } else { 35 | stop("Window dialog not permitted; 'file' argument must be specified") 36 | } 37 | } 38 | 39 | if (is.character(file)) { 40 | tr <- read.csv(file = file, strip.white = TRUE, stringsAsFactors = FALSE, 41 | encoding = "UTF-8") 42 | } else if (is.data.frame(file)) { 43 | # used when called from define_keywords() 44 | tr <- file 45 | } else { 46 | stop("invalid 'file' argument class: ", class(file)) 47 | } 48 | 49 | if (nrow(tr) == ncol(.translations)) { 50 | items <- tr$item 51 | tr <- as.data.frame(t(tr$custom), stringsAsFactors = FALSE) 52 | colnames(tr) <- items 53 | rownames(tr) <- "custom" 54 | } 55 | 56 | # Check contents 57 | expected <- ncol(.translations) 58 | tmp <- tr[,intersect(colnames(.translations), colnames(tr))] 59 | tmp <- tmp[,!is.na(tmp[1,])] 60 | nb_in <- ncol(tmp) 61 | nb_blank <- sum(as.character(tmp[1,]) == "") 62 | cols_missing <- setdiff(colnames(.translations), colnames(tmp)) 63 | pct_actual <- round((nb_in - nb_blank) * 100 / expected) 64 | 65 | if (pct_actual < 60) { 66 | warning("input file contains only ", pct_actual, "% of translated terms; ", 67 | "English will be used for missing terms") 68 | } else if (pct_actual < 100) { 69 | message("no translation found for the following term(s) ; English will be ", 70 | "used as fall-back values:\n ", 71 | paste(cols_missing, sQuote(.translations[1,cols_missing]), 72 | sep = " : ", collapse = "\n ")) 73 | } 74 | 75 | if (nb_in < expected) { 76 | tr <- .translations["en",] 77 | tr[,colnames(tmp)] <- tmp[1,] 78 | rownames(tr) <- "custom" 79 | } 80 | 81 | .st_env$custom_lang <- tr 82 | st_options(lang = "custom") 83 | # message("Operation successful") 84 | } 85 | -------------------------------------------------------------------------------- /R/what.is.R: -------------------------------------------------------------------------------- 1 | #' Obtain Extended Properties of Objects 2 | #' 3 | #' Combination of most common \dQuote{macro-level} functions that describe an 4 | #' object. 5 | #' 6 | #' An alternative to calling in turn \code{\link{class}}, \code{\link{typeof}}, 7 | #' \code{\link{dim}}, and so on. A call to this function will readily give all 8 | #' this information at once. 9 | #' 10 | #' @param x Any object. 11 | #' @param \dots Included for backward-compatibility only. Has no real use. 12 | #' 13 | #' @return A list with following elements: 14 | #' \describe{ 15 | #' \item{properties}{A data frame with the class(es), type, mode and storage 16 | #' mode of the object as well as the dim, length and object.size.} 17 | #' \item{attributes.lengths}{A named character vector giving all attributes 18 | #' (\emph{c.f.} \dQuote{names}, \dQuote{row.names}, \dQuote{class}, 19 | #' \dQuote{dim}, and so forth) along with their length.} 20 | #' \item{extensive.is}{A character vector of all the 21 | #' \emph{identifier functions.} (starting with \dQuote{is.}) that yield 22 | #' \code{TRUE} when used with \code{x} as argument.} 23 | #' \item{function.type}{When x is a function, results of 24 | #' \code{\link[pryr]{ftype}} are added.} 25 | #' } 26 | #' @author Dominic Comtois, \email{dominic.comtois@@gmail.com} 27 | #' 28 | #' @examples 29 | #' what.is(1) 30 | #' what.is(NaN) 31 | #' what.is(iris3) 32 | #' what.is(print) 33 | #' what.is(what.is) 34 | #' 35 | #' @seealso \code{\link{class}}, \code{\link{typeof}}, \code{\link{mode}}, 36 | #' \code{\link{storage.mode}}, \code{\link{dim}}, \code{\link{length}}, 37 | #' \code{\link{is.object}}, \code{\link[pryr]{otype}}, 38 | #' \code{\link{object.size}}, \code{\link[pryr]{ftype}} 39 | #' 40 | #' @keywords attribute classes utilities 41 | #' 42 | #' @importFrom utils methods object.size setTxtProgressBar txtProgressBar 43 | #' @importFrom methods is 44 | #' @importFrom pryr ftype otype 45 | #' @export 46 | what.is <- function(x, ...) { 47 | 48 | if ("ignore.size.warn" %in% names(list(...))) { 49 | message("ignore.size.warn is deprecated. The function has been modified ", 50 | "in such a way that objects of any size should be processed ", 51 | "rapidly") 52 | } 53 | 54 | if ("show.all" %in% names(list(...))) { 55 | message("show.all is deprecated.") 56 | } 57 | 58 | # set the warn option to -1 to temporarily ignore warnings 59 | op <- options("warn") 60 | options(warn = -1) 61 | on.exit(options(op)) 62 | 63 | # Part 1. Data Properties - class, typeof, mode, storage.mode 64 | properties <- 65 | data.frame( 66 | property = c("class", "typeof", "mode", "storage.mode", "dim", "length", 67 | "is.object","object.type","object.size"), 68 | value = c(paste(class(x),collapse=" "), typeof(x), mode(x), 69 | storage.mode(x), paste(dim(x), collapse = " x "), length(x), 70 | is.object(x), pryr::otype(x), paste(object.size(x), "Bytes")), 71 | stringsAsFactors = FALSE) 72 | 73 | 74 | # Part 2. Make a list of all x's attribute and their length 75 | attributes.lengths <- 76 | vapply(X = attributes(x), FUN = length, FUN.VALUE = numeric(1)) 77 | 78 | if(length(attributes.lengths)==0) { 79 | attributes.lengths <- NULL 80 | } 81 | 82 | # Part 3. Test object against all "is[...]" functions 83 | # Look for all relevant functions 84 | list.id.fun <- grep(methods(is), pattern = "<-", invert = TRUE, value = TRUE) 85 | 86 | # Remove functions which are not essential AND use a lot of time 87 | list.id.fun <- setdiff(list.id.fun, c("is.R", "is.single", "is.na.data.frame", 88 | "is.na.POSIXlt")) 89 | 90 | # loop over "is" functions with x as argument, and store the results 91 | extensive.is <- c() 92 | cat("Checking object against known 'is...' functions (", 93 | length(list.id.fun), ")", sep = "") 94 | 95 | # create progress bar if large object 96 | if (as.numeric(object.size(x)) > 500000 && length(list.id.fun) >= 10) { 97 | pb <- txtProgressBar(min = 0, max = length(list.id.fun), style = 3) 98 | } else { 99 | pb <- NA 100 | } 101 | 102 | for(i in seq_along(list.id.fun)) { 103 | # update progress bar 104 | if (!identical(pb, NA)) 105 | setTxtProgressBar(pb, i) 106 | fun <- list.id.fun[i] 107 | if (fun == "is.symmetric" && !is.matrix(x)) 108 | next 109 | res <- try(eval(call(fun, x)), silent=TRUE) 110 | if(isTRUE(res)) 111 | extensive.is <- append(extensive.is, fun) 112 | } 113 | if (!identical(pb, NA)) 114 | close(pb) 115 | 116 | # Part 4. Get info on the type of object - S3, S4, attributes / slots 117 | 118 | if(is.function(x)) { 119 | function.type <- pryr::ftype(x) 120 | } else { 121 | function.type <- NULL 122 | } 123 | 124 | output <- list() 125 | output$properties <- properties 126 | output$attributes.lengths <- attributes.lengths 127 | output$extensive.is <- extensive.is 128 | output$function.type <- function.type 129 | 130 | return(output) 131 | } 132 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | # Initialize vector containing paths to temporary html files generated when 2 | # viewing in browser or in RStudio visualization pane. Will be updated whenever 3 | # print.summarytools() / cleartmp() are called. 4 | .st_env <- new.env() 5 | 6 | # Initialize environment used by parse_call() 7 | .p <- new.env() 8 | 9 | # Determine OS : Windows | Linux | Darwin 10 | .st_env$sysname <- Sys.info()[["sysname"]] 11 | 12 | # Initialize vector for tempfiles -- useful for cleartmp() 13 | .st_env$tmpfiles <- c() 14 | 15 | # Initialise list used to keep track of current process 16 | .st_env$ps <- list() 17 | 18 | # Placeholder for customized translations 19 | .st_env$custom_lang <- list() 20 | 21 | # Predefined stats values for descr 22 | .st_env$descr.stats <- list( 23 | all = c("mean", "sd", "min", "q1", "med", "q3","max", "mad", 24 | "iqr", "cv", "skewness", "se.skewness", "kurtosis", 25 | "n.valid", "n", "pct.valid"), 26 | common = c("mean", "sd", "min", "med", "max", 27 | "n.valid", "n", "pct.valid"), 28 | fivenum = c("min", "q1", "med", "q3", "max") 29 | ) 30 | 31 | .st_env$descr.stats.valid <- list( 32 | no_wgts = c("mean", "sd", "min", "q1", "med", "q3","max", "mad", 33 | "iqr", "cv", "skewness", "se.skewness", "kurtosis", 34 | "n.valid", "n", "pct.valid"), 35 | wgts = c("mean", "sd", "min", "med", "max", "mad", "cv", 36 | "n.valid", "n", "pct.valid") 37 | ) 38 | 39 | # most common operators -- used by parse_call() 40 | .st_env$oper <- c("$", "[", "[[", "<", ">", "<=", ">=", "==", ":", "|>", 41 | "%!>%", "%$%", "%<>%", "%>%", "%T>%", "%>>%") 42 | 43 | # regex used in parse_call 44 | .st_env$re <-list( 45 | # 1) both names are there (df$name, df['name']), etc. 46 | two_names = paste0("^([\\w.]+)(\\$|\\[{1,2})(.*\\,\\s*)?['\"]?", 47 | "([a-zA-Z._][\\w._]*)['\"]?\\]{0,2}(\\[.+)?$"), 48 | 49 | # 2) there is numeric indexing (df[[2]], df[ ,2], df[2]) 50 | num_index = "^([\\w.]+)(\\$|\\[{1,2})(.*\\,\\s*)?(\\d+)\\]{1,2}(\\[.+)?$", 51 | 52 | 53 | # 3) fallback solution when only 1 name can be found / second group 54 | # can also be further decomposed if needed 55 | fallback_1name = "^([a-zA-Z._][\\w.]*)[$[]*(.*?)$", 56 | 57 | 58 | # 4) Like re #1 but doesn't match "df$name" 59 | two_names_no_doll = paste0("^([\\w.]+)(\\[{1,2})(.*\\,\\s*)?['\"]?", 60 | "([a-zA-Z._][\\w._]+)['\"]?\\]{0,2}(\\[.+)?$"), 61 | 62 | # 5) Negative indexing 63 | neg_num_index = paste0("^([\\w.]+)(\\$|\\[{1,2})(.*\\,\\s*)?", 64 | "(-\\d+)\\]{1,2}(\\[.+)?$") 65 | ) 66 | 67 | # "Hideous hack" to avoid warning on check 68 | utils::globalVariables(c(".")) 69 | 70 | # Define a null coalescing operator if not available 71 | if (getRversion() < "4.4.0") { 72 | if (!requireNamespace("backports", quietly = TRUE) || 73 | !exists("%||%", where = asNamespace("backports"), inherits = FALSE)) { 74 | `%||%` <- function(x, y) { 75 | if (is.null(x)) y else x 76 | } 77 | } else { 78 | `%||%` <- backports:::`%||%` 79 | } 80 | } 81 | 82 | # summarytools global options 83 | #' @importFrom utils data 84 | .onLoad <- function(libname, pkgname) { 85 | options(summarytools = 86 | list("style" = "simple", 87 | "plain.ascii" = TRUE, 88 | "round.digits" = 2, 89 | "headings" = TRUE, 90 | "footnote" = "default", 91 | "display.labels" = TRUE, 92 | "na.val" = NULL, 93 | "bootstrap.css" = TRUE, 94 | "custom.css" = NA, 95 | "escape.pipe" = FALSE, 96 | "char.split" = 12, 97 | "freq.cumul" = TRUE, 98 | "freq.totals" = TRUE, 99 | "freq.report.nas" = TRUE, 100 | "freq.ignore.threshold" = 25, 101 | "freq.silent" = FALSE, 102 | "ctable.prop" = "r", 103 | "ctable.totals" = TRUE, 104 | "ctable.round.digits" = 1, 105 | "ctable.silent" = FALSE, 106 | "descr.stats" = "all", 107 | "descr.transpose" = FALSE, 108 | "descr.silent" = FALSE, 109 | "dfSummary.style" = "multiline", 110 | "dfSummary.varnumbers" = TRUE, 111 | "dfSummary.class" = TRUE, 112 | "dfSummary.labels.col" = TRUE, 113 | "dfSummary.graph.col" = TRUE, 114 | "dfSummary.valid.col" = TRUE, 115 | "dfSummary.na.col" = TRUE, 116 | "dfSummary.graph.magnif" = 1, 117 | "dfSummary.silent" = FALSE, 118 | "dfSummary.custom.1" = 119 | expression( 120 | paste( 121 | paste0( 122 | trs("iqr"), " (", trs("cv"), ") : " 123 | ), 124 | format_number( 125 | IQR(column_data, na.rm = TRUE), round.digits 126 | ), 127 | " (", 128 | format_number( 129 | sd(column_data, na.rm = TRUE) / 130 | mean(column_data, na.rm = TRUE), round.digits 131 | ), 132 | ")", 133 | collapse = "", sep = "" 134 | ) 135 | ), 136 | "dfSummary.custom.2" = NA, 137 | "tmp.img.dir" = NA_character_, 138 | "subtitle.emphasis" = TRUE, 139 | "lang" = "en", 140 | "use.x11" = TRUE)) 141 | 142 | return(invisible()) 143 | } 144 | 145 | #' @importFrom utils packageDescription 146 | #' @importFrom pander panderOptions 147 | .onAttach <- function(libname, pkgname) { 148 | 149 | if (Sys.info()[["sysname"]] != "Windows" && !isTRUE(capabilities("X11"))) { 150 | packageStartupMessage("system might not have X11 capabilities; in case of ", 151 | "errors when using dfSummary(), set ", 152 | "st_options(use.x11 = FALSE)") 153 | } 154 | } 155 | 156 | -------------------------------------------------------------------------------- /data/examens.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/data/examens.RData -------------------------------------------------------------------------------- /data/exams.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/data/exams.RData -------------------------------------------------------------------------------- /data/tabagisme.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/data/tabagisme.RData -------------------------------------------------------------------------------- /data/tobacco.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/data/tobacco.RData -------------------------------------------------------------------------------- /doc/Custom-Statistics-in-dfSummary.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Custom Statistics in dfSummary" 3 | author: Dominic Comtois 4 | date: "`r Sys.Date()`" 5 | output: 6 | pdf_document: 7 | highlight: tango 8 | latex_engine: xelatex 9 | extra_dependencies: xcolor 10 | includes: 11 | in_header: 12 | - !expr system.file("includes/fig-valign.tex", package = "summarytools") 13 | --- 14 | 15 | \definecolor{MidnightBlue}{HTML}{2E74B5} 16 | 17 | ```{r, include=FALSE} 18 | library(knitr) 19 | opts_chunk$set(comment = NA, 20 | prompt = FALSE, 21 | cache = FALSE, 22 | echo = TRUE, 23 | results = 'asis') 24 | library(summarytools) 25 | ``` 26 | 27 | This document shows how to customize the content of the *Stats / Values* column 28 | in [\color{MidnightBlue}{data frame 29 | summaries}](https://cran.r-project.org/web/packages/summarytools/vignettes/introduction.html#data-frame-summaries-dfsummary) 30 | generated using `summarytools::dfSummary()`. This feature was introduced in 31 | version 1.0.0 of 32 | [**summarytools**](https://CRAN.R-project.org/package=summarytools)as a response 33 | to a feature request that came up several times, in a 34 | [\color{MidnightBlue}{form}](https://github.com/dcomtois/summarytools/issues/33) 35 | or 36 | [\color{MidnightBlue}{another}](https://github.com/dcomtois/summarytools/issues/74). 37 | 38 | ## How it works 39 | 40 | Two new options were created: `dfSummary.custom.1` and `dfSummary.custom.2`. The 41 | first one has a predefined value -- it is the one that makes up the fourth row 42 | of the cell (showing IQR and CV). The second one is set to `NA` by default. If 43 | both options are defined (non-`NA`), the cell will now show 5 lines rather than 44 | 4, provided there are no additional line feed occurring within the cell, be it 45 | by design or by an "overflow" of one of the custom lines. 46 | 47 | ### Setup & Baseline 48 | 49 | We'll use the first column of *iris* to show results as they are before making 50 | any changes. But first, a little bit of setting-up: 51 | 52 | \vspace{8pt} 53 | 54 | ```{r} 55 | library(summarytools) 56 | st_options(plain.ascii = FALSE, 57 | headings = FALSE, 58 | footnote = NA, 59 | round.digits = 1, 60 | style = "rmarkdown", # For freq(), descr(), & ctable() 61 | dfSummary.varnumbers = FALSE, 62 | dfSummary.valid.col = FALSE, 63 | dfSummary.silent = TRUE, 64 | dfSummary.style = "grid", 65 | tmp.img.dir = "img") 66 | ``` 67 | 68 | Now let's show the default output: \vspace{8pt} 69 | 70 | ```{r} 71 | iris_subset <- iris[1] 72 | dfSummary(iris_subset, graph.magnif = .45) 73 | ``` 74 | 75 | ## Example 1 : Removing *IQR (CV)* 76 | 77 | Setting `dfSummary.custom.1` to `NA` will remove the last line in *Stats / 78 | Values*: \vspace{8pt} 79 | 80 | ```{r} 81 | st_options(dfSummary.custom.1 = NA) 82 | dfSummary(iris_subset, graph.magnif = .35) # Adjust graph size accordingly 83 | ``` 84 | 85 | ## Example 2 : Adding *Q1* & *Q3* 86 | 87 | Here we'll create the expression needed to generate new statistics, *Q1* & *Q3*. 88 | The expression is evaluated while looping on column data, and we need to refer 89 | to that data. The variable name to use is, well, `column_data`. Another variable 90 | you can use is `round.digits` (we've set to `1` in the setup chunk on page 1). 91 | \vspace{8pt} 92 | 93 | ```{r} 94 | st_options( 95 | dfSummary.custom.1 = 96 | expression( 97 | paste( 98 | "Q1 - Q3 :", 99 | round( 100 | quantile(column_data, 101 | probs = .25, 102 | type = 2, 103 | names = FALSE, 104 | na.rm = TRUE), 105 | digits = round.digits 106 | ), " - ", 107 | round( 108 | quantile(column_data, 109 | probs = .75, 110 | type = 2, 111 | names = FALSE, 112 | na.rm = TRUE), 113 | digits = round.digits 114 | ) 115 | ) 116 | ) 117 | ) 118 | 119 | dfSummary(iris_subset, graph.magnif = .45) 120 | ``` 121 | 122 | ## Example 3: Inserting Back *IQR (CV)* 123 | 124 | It is always possible to reset the value of `dfSummary.custom.1` to its initial 125 | value by using 126 | 127 | ```{r, eval=FALSE} 128 | st_options(dfSummary.custom.1 = "default") 129 | ``` 130 | 131 | But let's make things a bit more interesting by actually showing *IQR (CV)* 132 | **under** *Q1* & *Q3*. For this, we will use the default expression for 133 | `dfSummary.custom.1` to define `dfSummary.custom.2`: 134 | 135 | \vspace{8pt} 136 | 137 | ```{r} 138 | st_options( 139 | dfSummary.custom.2 = 140 | expression( 141 | paste( 142 | paste0( 143 | trs("iqr"), " (", trs("cv"), ") : " 144 | ), 145 | format_number( 146 | IQR(column_data, na.rm = TRUE), 147 | round.digits 148 | ), 149 | " (", 150 | format_number( 151 | sd(column_data, na.rm = TRUE) / 152 | mean(column_data, na.rm = TRUE), 153 | round.digits 154 | ), 155 | ")", 156 | collapse = "", 157 | sep = "" 158 | ) 159 | ) 160 | ) 161 | 162 | dfSummary(iris[3:5], graph.magnif = .65) # Again, graph size adjusted 163 | ``` 164 | 165 | Don't forget to set `na.rm = TRUE` whenever necessary (most base R statistics 166 | use it with `FALSE` as default). 167 | 168 | ## Number Formatting 169 | 170 | You may have noticed that instead of `round()`, we used `format_number()`, which 171 | is a **summarytools** internal function. It applies not only rounding, but all 172 | relevant formatting attributes as well (*nsmall, decimal.mark, big.mark, 173 | scientific*,and so on). 174 | 175 | ## Displaying Formatted Expressions 176 | 177 | As shown in the 178 | [\color{MidnightBlue}{Introduction to summarytools}](https://cran.r-project.org/web/packages/summarytools/vignettes/introduction.html) 179 | vignette, the following bit of code can be used to retrieve and format the 180 | expressions stored in the custom options. To achieve good results, the chunk 181 | option `results='markup'` was used for this chunk. 182 | 183 | ```{r, results='markup'} 184 | st_options(dfSummary.custom.1 = "default") 185 | formatR::tidy_source( 186 | text = deparse(st_options("dfSummary.custom.1")), 187 | indent = 2, 188 | args.newline = TRUE 189 | ) 190 | ``` 191 | 192 | ## Useful links 193 | 194 | 1. [\color{MidnightBlue}{Introduction to summarytools}](https://cran.r-project.org/web/packages/summarytools/vignettes/introduction.html) 195 | (package vignette) 196 | 2. [\color{MidnightBlue}{Summarytools in R Markdown Documents}](https://cran.r-project.org/web/packages/summarytools/vignettes/rmarkdown.html) 197 | (package vignette) 198 | 3. [\color{MidnightBlue}{Data Frame Summaries in PDF's}](https://raw.githubusercontent.com/dcomtois/summarytools/master/doc/Data-Frame-Summaries-in-PDFs.pdf) 199 | (supplemental documentation) 200 | -------------------------------------------------------------------------------- /doc/Custom-Statistics-in-dfSummary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/doc/Custom-Statistics-in-dfSummary.pdf -------------------------------------------------------------------------------- /doc/Data-Frame-Summaries-in-PDFs.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/doc/Data-Frame-Summaries-in-PDFs.pdf -------------------------------------------------------------------------------- /doc/assets/define_keywords.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/doc/assets/define_keywords.png -------------------------------------------------------------------------------- /doc/assets/dfSummary_in_RStudio_Viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/doc/assets/dfSummary_in_RStudio_Viewer.png -------------------------------------------------------------------------------- /doc/assets/dfSummary_md.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/doc/assets/dfSummary_md.png -------------------------------------------------------------------------------- /doc/assets/exclamation-diamond.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/assets/lightbulb.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /doc/assets/vignette.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | margin: 1em auto; 4 | max-width: 700px; 5 | overflow: visible; 6 | padding-left: 2em; 7 | padding-right: 2em; 8 | font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; 9 | font-size: 14px; 10 | line-height: 1.45; 11 | } 12 | 13 | /* Start Edit DC */ 14 | .infobox { 15 | padding: .8em; 16 | margin: 10px; 17 | border: 1px solid SteelBlue; 18 | border-radius: 5px; 19 | background: #f5f5f5 5px center/3em no-repeat; 20 | } 21 | /* End Edit DC */ 22 | 23 | #TOC { 24 | clear: both; 25 | margin: 0 0 10px 10px; 26 | padding: 4px; 27 | width: 75%; 28 | border: 1px solid #CCCCCC; 29 | border-radius: 5px; 30 | 31 | background-color: #f6f6f6; 32 | font-size: 13px; 33 | line-height: 1.7; 34 | } 35 | 36 | #TOC .toctitle { 37 | font-weight: bold; 38 | font-size: 15px; 39 | margin-left: 5px; 40 | } 41 | 42 | #TOC ul { 43 | padding-left: 40px; 44 | margin-left: -1.5em; 45 | margin-top: 5px; 46 | margin-bottom: 5px; 47 | } 48 | #TOC ul ul { 49 | margin-left: -2em; 50 | } 51 | #TOC li { 52 | line-height: 20px; 53 | } 54 | 55 | table { 56 | margin: 1em auto; 57 | border-width: 1px; 58 | border-color: #DDDDDD; 59 | border-style: outset; 60 | border-collapse: collapse; 61 | } 62 | table th { 63 | border-width: 2px; 64 | padding: 5px; 65 | border-style: inset; 66 | } 67 | table td { 68 | border-width: 1px; 69 | border-style: inset; 70 | line-height: 18px; 71 | padding: 5px 5px; 72 | } 73 | table, table th, table td { 74 | border-left-style: none; 75 | border-right-style: none; 76 | } 77 | table thead, table tr.even { 78 | background-color: #f7f7f7; 79 | } 80 | 81 | p { 82 | margin: 0.8em 0 0.6em 0; /* Edited DC */ 83 | } 84 | 85 | blockquote { 86 | background-color: #f6f6f6; 87 | padding: 0.25em 0.75em; 88 | } 89 | 90 | hr { 91 | border-style: solid; 92 | border: none; 93 | border-top: 1px solid #777; 94 | margin: 28px 0; 95 | } 96 | 97 | dl { 98 | margin-left: 0; 99 | } 100 | dl dd { 101 | margin-bottom: 13px; 102 | margin-left: 13px; 103 | } 104 | dl dt { 105 | font-weight: bold; 106 | } 107 | 108 | ul { 109 | margin-top: 0; 110 | } 111 | ul li { 112 | list-style: circle outside; 113 | } 114 | ul ul { 115 | margin-bottom: 0; 116 | } 117 | 118 | pre, code { 119 | background-color: #f7f7f7; 120 | border-radius: 3px; 121 | color: #333; 122 | white-space: pre-wrap; /* Wrap long lines */ 123 | } 124 | pre { 125 | border-radius: 3px; 126 | margin: 5px 0px 10px 0px; 127 | padding: 10px; 128 | } 129 | pre:not([class]) { 130 | background-color: #f7f7f7; 131 | } 132 | 133 | code { 134 | font-family: Consolas, Monaco, 'Courier New', monospace; 135 | font-size: 85%; 136 | } 137 | p > code, li > code { 138 | padding: 2px 0px; 139 | } 140 | 141 | div.figure { 142 | text-align: center; 143 | } 144 | img { 145 | background-color: #FFFFFF; 146 | padding: 2px; 147 | border: 1px solid #DDDDDD; 148 | border-radius: 3px; 149 | border: 1px solid #CCCCCC; 150 | margin: 0 5px; 151 | } 152 | 153 | h1 { 154 | margin-top: 0; 155 | font-size: 35px; 156 | line-height: 40px; 157 | } 158 | 159 | h2 { 160 | border-bottom: 4px solid #f7f7f7; 161 | padding-top: 10px; 162 | padding-bottom: 2px; 163 | font-size: 145%; 164 | } 165 | 166 | h3 { 167 | border-bottom: 2px solid #f7f7f7; 168 | padding-top: 10px; 169 | font-size: 120%; 170 | } 171 | 172 | h4 { 173 | border-bottom: 1px solid #f7f7f7; 174 | margin-left: 8px; 175 | font-size: 105%; 176 | } 177 | 178 | h5, h6 { 179 | border-bottom: 1px solid #ccc; 180 | font-size: 105%; 181 | } 182 | 183 | a { 184 | color: #0033dd; 185 | text-decoration: none; 186 | } 187 | a:hover { 188 | color: #6666ff; } 189 | a:visited { 190 | color: #800080; } 191 | a:visited:hover { 192 | color: #BB00BB; } 193 | a[href^="http:"] { 194 | text-decoration: underline; } 195 | a[href^="https:"] { 196 | text-decoration: underline; } 197 | 198 | /* Class described in https://benjeffrey.com/posts/pandoc-syntax-highlighting-css 199 | Colours from https://gist.github.com/robsimmons/1172277 */ 200 | 201 | code > span.kw { color: #555; font-weight: bold; } /* Keyword */ 202 | code > span.dt { color: #902000; } /* DataType */ 203 | code > span.dv { color: #40a070; } /* DecVal (decimal values) */ 204 | code > span.bn { color: #d14; } /* BaseN */ 205 | code > span.fl { color: #d14; } /* Float */ 206 | code > span.ch { color: #d14; } /* Char */ 207 | code > span.st { color: #d14; } /* String */ 208 | code > span.co { color: #888888; font-style: italic; } /* Comment */ 209 | code > span.ot { color: #007020; } /* OtherToken */ 210 | code > span.al { color: #ff0000; font-weight: bold; } /* AlertToken */ 211 | code > span.fu { color: #900; font-weight: bold; } /* Function calls */ 212 | code > span.er { color: #a61717; background-color: #e3d2d2; } /* ErrorTok */ 213 | 214 | -------------------------------------------------------------------------------- /doc/include-header.tex: -------------------------------------------------------------------------------- 1 | \usepackage{graphicx} 2 | \usepackage[export]{adjustbox} 3 | \usepackage{letltxmacro} 4 | -------------------------------------------------------------------------------- /doc/include-renew-cmd.tex: -------------------------------------------------------------------------------- 1 | \LetLtxMacro{\OldIncludegraphics}{\includegraphics} 2 | \renewcommand{\includegraphics}[2][]{\raisebox{0.5\height}% 3 | {\OldIncludegraphics[valign=t,#1]{#2}}} 4 | -------------------------------------------------------------------------------- /doc/rmarkdown.R: -------------------------------------------------------------------------------- 1 | ## ----setup, include=FALSE----------------------------------------------------- 2 | library(knitr) 3 | opts_chunk$set(comment = NA, 4 | prompt = FALSE, 5 | cache = FALSE, 6 | echo = TRUE, 7 | results = 'asis') 8 | library(summarytools) 9 | st_options(bootstrap.css = FALSE, # Already part of the theme so no need for it 10 | plain.ascii = FALSE, # One of the essential settings 11 | style = "rmarkdown", # Idem. 12 | dfSummary.silent = TRUE, # Suppresses messages about temporary files 13 | footnote = NA, # Keeping the results minimalist 14 | descr.silent = TRUE, # To avoid messages when building / checking 15 | subtitle.emphasis = FALSE) # For the vignette theme, this gives better results. 16 | # For other themes, using TRUE might be preferable. 17 | 18 | ## ----echo=FALSE--------------------------------------------------------------- 19 | st_css(main = TRUE, global = TRUE) 20 | 21 | ## ----eval=FALSE--------------------------------------------------------------- 22 | # st_options(plain.ascii = FALSE, style = "rmarkdown") 23 | 24 | ## ----------------------------------------------------------------------------- 25 | freq(tobacco$gender, plain.ascii = FALSE, style = 'rmarkdown') 26 | 27 | ## ----------------------------------------------------------------------------- 28 | print(freq(tobacco$gender), method = 'render') 29 | 30 | ## ----message=FALSE------------------------------------------------------------ 31 | print(descr(tobacco), method = 'render', table.classes = 'st-small') 32 | 33 | ## ----------------------------------------------------------------------------- 34 | ctable(tobacco$gender, 35 | tobacco$smoker, 36 | plain.ascii = FALSE, 37 | style = 'rmarkdown') 38 | 39 | ## ----ctable_html-------------------------------------------------------------- 40 | print(ctable(tobacco$gender, tobacco$smoker), method = 'render') 41 | 42 | ## ----------------------------------------------------------------------------- 43 | descr(tobacco, plain.ascii = FALSE, style = 'rmarkdown') 44 | 45 | ## ----message=FALSE------------------------------------------------------------ 46 | print(descr(tobacco), method = 'render', table.classes = 'st-small') 47 | 48 | ## ----dfs_grid, eval=FALSE----------------------------------------------------- 49 | # dfSummary(tobacco, 50 | # plain.ascii = FALSE, 51 | # style = 'grid', 52 | # graph.magnif = 0.85, 53 | # varnumbers = FALSE, 54 | # valid.col = FALSE, 55 | # tmp.img.dir = "/tmp") 56 | 57 | ## ----------------------------------------------------------------------------- 58 | print(dfSummary(tobacco, 59 | varnumbers = FALSE, 60 | valid.col = FALSE, 61 | graph.magnif = 0.76), 62 | method = 'render') 63 | 64 | ## ----------------------------------------------------------------------------- 65 | print(dfSummary(tobacco, 66 | varnumbers = FALSE, 67 | valid.col = FALSE, 68 | graph.magnif = 0.76), 69 | max.tbl.height = 300, 70 | method = "render") 71 | 72 | ## ----------------------------------------------------------------------------- 73 | library(kableExtra) 74 | library(magrittr) 75 | stby(iris, iris$Species, descr, stats = "fivenum") |> 76 | tb() |> 77 | kable(format = "html", digits = 2) |> 78 | collapse_rows(columns = 1, valign = "top") 79 | 80 | ## ----------------------------------------------------------------------------- 81 | stby(iris, iris$Species, descr, stats = "fivenum") |> 82 | tb(order = 3) |> 83 | kable(format = "html", digits = 2) |> 84 | collapse_rows(columns = 1, valign = "top") 85 | 86 | -------------------------------------------------------------------------------- /img/Russian-freq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/Russian-freq.png -------------------------------------------------------------------------------- /img/bmc_qr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/bmc_qr.png -------------------------------------------------------------------------------- /img/collage.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/collage.pdn -------------------------------------------------------------------------------- /img/collage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/collage.png -------------------------------------------------------------------------------- /img/ctable-barebones-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/ctable-barebones-2.png -------------------------------------------------------------------------------- /img/ctable-barebones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/ctable-barebones.png -------------------------------------------------------------------------------- /img/ctable-chisq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/ctable-chisq.png -------------------------------------------------------------------------------- /img/ctable-minimal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/ctable-minimal.png -------------------------------------------------------------------------------- /img/ctable-row-proportions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/ctable-row-proportions.png -------------------------------------------------------------------------------- /img/ctable-statistics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/ctable-statistics.png -------------------------------------------------------------------------------- /img/ctable-with-row-props.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/ctable-with-row-props.png -------------------------------------------------------------------------------- /img/define-keywords.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/define-keywords.png -------------------------------------------------------------------------------- /img/define_keywords.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/define_keywords.png -------------------------------------------------------------------------------- /img/descr-kableExtra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/descr-kableExtra.png -------------------------------------------------------------------------------- /img/dfSummary-in-RStudio-Viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/dfSummary-in-RStudio-Viewer.png -------------------------------------------------------------------------------- /img/dfSummary-render-in-markdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/dfSummary-render-in-markdown.png -------------------------------------------------------------------------------- /img/dfSummary-scroll-window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/dfSummary-scroll-window.png -------------------------------------------------------------------------------- /img/dfSummary_in_RStudio_Viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/dfSummary_in_RStudio_Viewer.png -------------------------------------------------------------------------------- /img/dfSummary_md.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/dfSummary_md.png -------------------------------------------------------------------------------- /img/freq-fr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/freq-fr.png -------------------------------------------------------------------------------- /img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/logo.png -------------------------------------------------------------------------------- /img/repository-open-graph-template.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/repository-open-graph-template.pdn -------------------------------------------------------------------------------- /img/st-banner-fuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/st-banner-fuzzy.png -------------------------------------------------------------------------------- /img/summarytools-card.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/summarytools-card.pdn -------------------------------------------------------------------------------- /img/summarytools-card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/summarytools-card.png -------------------------------------------------------------------------------- /img/summarytools-tabletop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/summarytools-tabletop.png -------------------------------------------------------------------------------- /img/summarytools-text.dtp: -------------------------------------------------------------------------------- 1 | TextPlusData|0|Monotype Corsiva|100|1|False|False|0|0|0|False|30|False|0|False|26|True|500|200|200|0|True|summarytools 2 | -------------------------------------------------------------------------------- /img/tb-kableExtra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/img/tb-kableExtra.png -------------------------------------------------------------------------------- /inst/WORDLIST: -------------------------------------------------------------------------------- 1 | ’ 2 | ’s 3 | analytics 4 | anglais 5 | arbitraire 6 | arg 7 | args 8 | Ashirwad 9 | asis 10 | autour 11 | avec 12 | barcode 13 | Barnwal 14 | basee 15 | behaviour 16 | BMI 17 | categorie 18 | categorielle 19 | CentOS 20 | centrees 21 | chacun 22 | chaque 23 | chisq 24 | CI 25 | CI's 26 | cigs 27 | colonnes 28 | comtois 29 | contenant 30 | corporelle 31 | css 32 | csv 33 | ctable 34 | cumul 35 | customizable 36 | cv 37 | d'age 38 | d'une 39 | dans 40 | Daróczi's 41 | de 42 | des 43 | desc 44 | descr 45 | Deux 46 | Dev 47 | df 48 | dfSummaries 49 | dfsummary 50 | dfSummary 51 | dir 52 | dmg 53 | dominic 54 | donnees 55 | Donnees 56 | dplyr 57 | du 58 | dtupdate 59 | EAN 60 | ecart 61 | echantillonal 62 | economie 63 | english 64 | Environ 65 | et 66 | etat 67 | etudiant 68 | etudiants 69 | examens 70 | facteur 71 | facto 72 | faisant 73 | favicon 74 | Feitsma 75 | Fille 76 | fivenum 77 | fonction 78 | formattable 79 | francais 80 | Fréq 81 | Freqs 82 | fréquences 83 | fumees 84 | fumeur 85 | geographie 86 | Gergely 87 | getbootstrap 88 | gmail 89 | Groupe 90 | histoire 91 | Hmisc 92 | htmltools 93 | https 94 | ifany 95 | IMC 96 | img 97 | Indice 98 | infobox 99 | intervenir 100 | iqr 101 | Jeu 102 | jira 103 | Joerg 104 | jour 105 | kableExtra 106 | knitr 107 | knitr's 108 | l'age 109 | l'etudiant 110 | l'IMC 111 | labelled 112 | lang 113 | le 114 | les 115 | Lua 116 | magick 117 | Magick 118 | magnif 119 | magrittr 120 | malade 121 | maladie 122 | masse 123 | maths 124 | md 125 | moyenne 126 | na 127 | nas 128 | nbr 129 | Nilsson 130 | niveaux 131 | Nom 132 | nombre 133 | Nombre 134 | nrow 135 | nsmall 136 | numerique 137 | Numerique 138 | OOP 139 | Oui 140 | outputs 141 | outputs’ 142 | packages’ 143 | pagedown 144 | pandoc 145 | Pandoc 146 | PDF’s 147 | personnelle 148 | pipeR 149 | plyr's 150 | png 151 | Poids 152 | ponderation 153 | POSIXt 154 | pre 155 | probabilite 156 | programmatically 157 | px 158 | quartile 159 | Quartile 160 | raisebox 161 | randomises 162 | rangees 163 | rapportools 164 | Rdoc 165 | README 166 | README.Rmd 167 | results’ 168 | RGui 169 | rmarkdown 170 | Rmarkdown 171 | Rmd 172 | Roxygen 173 | RStudio 174 | RStudio’s 175 | ru 176 | Rubets 177 | Sahlmann 178 | samp 179 | sante 180 | Sante 181 | SAS’s 182 | SAS's 183 | scrollable 184 | sd 185 | se 186 | setosa 187 | sexe 188 | simulees 189 | sont 190 | SPSS’s 191 | SPSS's 192 | Stata 193 | stby 194 | stylesheets 195 | Stylesheets 196 | stylings 197 | suivantes 198 | sujet 199 | sujets 200 | summarytools’ 201 | sur 202 | sys 203 | Tabac 204 | tabac 205 | tabagisme 206 | tbl 207 | Tesler's 208 | tex 209 | texte 210 | tibble 211 | tibbles 212 | Tibbles 213 | tidyverse 214 | tmp 215 | tomber 216 | TOpdf 217 | un 218 | Un 219 | une 220 | unistats 221 | unshown 222 | useNA 223 | Valide 224 | varnumbers 225 | versicolor 226 | virginica 227 | wgts 228 | wkhtmltopdf 229 | yaml 230 | xelatex 231 | Xenial 232 | xquartz 233 | XQuartz 234 | -------------------------------------------------------------------------------- /inst/includes/favicon.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /inst/includes/fig-valign.tex: -------------------------------------------------------------------------------- 1 | % Use this file as a preamble to create pdf's with dfSummaries. 2 | % One possible way if to use it directly in the YAML section: 3 | % output: 4 | % pdf_document: 5 | % latex_engine: xelatex 6 | % includes: 7 | % in_header: 8 | % - !expr system.file("includes/fig-valign.tex", package = "summarytools") 9 | \usepackage{graphicx} 10 | \usepackage[export]{adjustbox} 11 | \usepackage{letltxmacro} 12 | \LetLtxMacro{\OldIncludegraphics}{\includegraphics} 13 | \renewcommand{\includegraphics}[2][]{\raisebox{0.5\height}% 14 | {\OldIncludegraphics[valign=t,#1]{#2}}} 15 | -------------------------------------------------------------------------------- /inst/includes/language_template.csv: -------------------------------------------------------------------------------- 1 | item ,context ,custom 2 | title.freq ,main heading ,Frequencies 3 | title.freq.weighted ,main heading ,Weighted Frequencies 4 | title.ctable ,main heading ,Cross-Tabulation 5 | title.ctable.weighted ,main heading ,Weighted Cross-Tabulation 6 | title.ctable.row ,main heading ,Row Proportions 7 | title.ctable.col ,main heading ,Column Proportions 8 | title.ctable.tot ,main heading ,Total Proportions 9 | title.descr ,main heading ,Descriptive Statistics 10 | title.descr.weighted ,main heading ,Weighted Descriptive Statistics 11 | title.dfSummary ,main heading ,Data Frame Summary 12 | n ,heading label ,N 13 | dimensions ,heading label (dfSummary) ,Dimensions 14 | duplicates ,heading label (dfSummary) ,Duplicates 15 | data.frame ,heading label (all functions) ,Data Frame 16 | label ,heading label (all functions) & column name (dfSummary) ,Label 17 | variable ,heading label (all functions) & column name (dfSummary) ,Variable 18 | group ,heading label (all functions when used with byst() / by() ,Group 19 | by ,heading label (descr when used with byst() / by() ,by 20 | weights ,heading label (descr & freq) ,Weights 21 | type ,heading label (freq) ,Type 22 | logical ,heading value for type (freq) ,Logical 23 | character ,heading value for type (freq) ,Character 24 | numeric ,heading value for type (freq) ,Numeric 25 | integer ,heading value for type (freq) ,Integer 26 | factor ,heading value for type (freq) ,Factor 27 | factor.ordered ,heading value for type (freq) ,Ordered Factor 28 | date ,heading value for type (freq) ,Date 29 | datetime ,heading value for type (freq) ,Datetime 30 | freq ,column name (freq) ,Freq 31 | pct ,column name (freq - when report.nas=FALSE) ,% 32 | pct.valid.f ,column name (freq) ,% Valid 33 | pct.valid.cum ,column name (freq) ,% Valid Cum. 34 | pct.total ,column name (freq) ,% Total 35 | pct.total.cum ,column name (freq) ,% Total Cum. 36 | pct.cum ,column name (freq) ,% Cum. 37 | valid ,column name (freq & dfSummary) & column content (dfSummary) ,Valid 38 | invalid ,column content (dfSummary for emails) ,Invalid 39 | total ,column grouping in html (freq) ,Total 40 | mean ,row name (descr) ,Mean 41 | sd.long ,row name (descr) ,Std.Dev 42 | sd ,cell content (dfSummary) ,sd 43 | min ,row name (descr) ,Min 44 | q1 ,row name (descr) - 1st quartile ,Q1 45 | med ,row name (descr) ,Median 46 | q3 ,row name (descr) - 3rd quartile ,Q3 47 | max ,row name (descr) ,Max 48 | mad ,row name (descr) - Median Absolute Deviation ,MAD 49 | iqr ,row name (descr) - Inter-Quartile Range ,IQR 50 | cv ,row name (descr) - Coefficient of Variation ,CV 51 | skewness ,row name (descr) ,Skewness 52 | se.skewness ,row name (descr) - Std. Error for Skewness ,SE.Skewness 53 | kurtosis ,row name (descr) ,Kurtosis 54 | n.valid ,row name (descr) - Count of non-missing values ,N.Valid 55 | pct.valid ,row name (descr) - % of non-missing values ,Pct.Valid 56 | no ,column name (dfSummary) - position of column in the d.f. ,No 57 | stats.values ,column name (dfSummary) ,Stats / Values 58 | freqs.pct.valid ,column name (dfSummary) ,Freqs (% of Valid) 59 | graph ,column name (dfSummary) ,Graph 60 | missing ,column name (dfSummary) ,Missing 61 | distinct.value ,cell content (dfSummary) - singular form ,distinct value 62 | distinct.values ,cell content (dfSummary) - plural form ,distinct values 63 | all.nas ,cell content (dfSummary) - column has only NA's ,All NA's 64 | empty.str ,cell content (freq) - column has values equal to "" ,Empty string 65 | all.empty.str ,cell content (dfSummary) - column has only empty str's ,All empty strings 66 | all.empty.str.nas ,cell content (dfSummary) - col. has only NA's and empty str's ,All empty strings / NA's 67 | no.levels.defined ,cell content (dfSummary) - factor has no levels defined ,No levels defined 68 | int.sequence ,cell content (dfSummary) ,Integer sequence 69 | rounded ,cell content (dfSummary) - note appearing in Stats/Values ,rounded 70 | other ,cell content (freq) - used w/ rows arg (filtered out values) ,(Other) 71 | others ,cell content (dfSummary) - nbr of values not displayed ,others 72 | codes ,cell content (dfSummary) - When UPC codes are detected ,codes 73 | mode ,cell content (dfSummary) - mode = most frequent value ,mode 74 | med.short ,cell content (dfSummary) - median (shortened) ,med 75 | start ,cell content (dfSummary) - earliest date for date-type cols. ,Start 76 | end ,cell content (dfSummary) - latest date for data-type cols. ,End 77 | emails ,cell content (dfSummary) ,Emails 78 | generated.by ,footnote content ,Generated by 79 | version ,footnote content ,version 80 | date.fmt ,footnote - date format (see ?strptime) ,%Y-%m-%d 81 | -------------------------------------------------------------------------------- /inst/includes/stylesheets/bootstrap-reboot.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 The Bootstrap Authors 4 | * Copyright 2011-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */ 8 | *, 9 | *::before, 10 | *::after { 11 | box-sizing: border-box; 12 | } 13 | 14 | html { 15 | font-family: sans-serif; 16 | line-height: 1.15; 17 | -webkit-text-size-adjust: 100%; 18 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 19 | } 20 | 21 | article, aside, figcaption, figure, footer, header, hgroup, main, nav, section { 22 | display: block; 23 | } 24 | 25 | body { 26 | margin: 0; 27 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 28 | font-size: 1rem; 29 | font-weight: 400; 30 | line-height: 1.5; 31 | color: #212529; 32 | text-align: left; 33 | background-color: #fff; 34 | } 35 | 36 | [tabindex="-1"]:focus { 37 | outline: 0 !important; 38 | } 39 | 40 | hr { 41 | box-sizing: content-box; 42 | height: 0; 43 | overflow: visible; 44 | } 45 | 46 | h1, h2, h3, h4, h5, h6 { 47 | margin-top: 0; 48 | margin-bottom: 0.5rem; 49 | } 50 | 51 | p { 52 | margin-top: 0; 53 | margin-bottom: 1rem; 54 | } 55 | 56 | abbr[title], 57 | abbr[data-original-title] { 58 | text-decoration: underline; 59 | -webkit-text-decoration: underline dotted; 60 | text-decoration: underline dotted; 61 | cursor: help; 62 | border-bottom: 0; 63 | -webkit-text-decoration-skip-ink: none; 64 | text-decoration-skip-ink: none; 65 | } 66 | 67 | address { 68 | margin-bottom: 1rem; 69 | font-style: normal; 70 | line-height: inherit; 71 | } 72 | 73 | ol, 74 | ul, 75 | dl { 76 | margin-top: 0; 77 | margin-bottom: 1rem; 78 | } 79 | 80 | ol ol, 81 | ul ul, 82 | ol ul, 83 | ul ol { 84 | margin-bottom: 0; 85 | } 86 | 87 | dt { 88 | font-weight: 700; 89 | } 90 | 91 | dd { 92 | margin-bottom: .5rem; 93 | margin-left: 0; 94 | } 95 | 96 | blockquote { 97 | margin: 0 0 1rem; 98 | } 99 | 100 | b, 101 | strong { 102 | font-weight: bolder; 103 | } 104 | 105 | small { 106 | font-size: 80%; 107 | } 108 | 109 | sub, 110 | sup { 111 | position: relative; 112 | font-size: 75%; 113 | line-height: 0; 114 | vertical-align: baseline; 115 | } 116 | 117 | sub { 118 | bottom: -.25em; 119 | } 120 | 121 | sup { 122 | top: -.5em; 123 | } 124 | 125 | a { 126 | color: #007bff; 127 | text-decoration: none; 128 | background-color: transparent; 129 | } 130 | 131 | a:hover { 132 | color: #0056b3; 133 | text-decoration: underline; 134 | } 135 | 136 | a:not([href]):not([tabindex]) { 137 | color: inherit; 138 | text-decoration: none; 139 | } 140 | 141 | a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus { 142 | color: inherit; 143 | text-decoration: none; 144 | } 145 | 146 | a:not([href]):not([tabindex]):focus { 147 | outline: 0; 148 | } 149 | 150 | pre, 151 | code, 152 | kbd, 153 | samp { 154 | font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 155 | font-size: 1em; 156 | } 157 | 158 | pre { 159 | margin-top: 0; 160 | margin-bottom: 1rem; 161 | overflow: auto; 162 | } 163 | 164 | figure { 165 | margin: 0 0 1rem; 166 | } 167 | 168 | img { 169 | vertical-align: middle; 170 | border-style: none; 171 | } 172 | 173 | svg { 174 | overflow: hidden; 175 | vertical-align: middle; 176 | } 177 | 178 | table { 179 | border-collapse: collapse; 180 | } 181 | 182 | caption { 183 | padding-top: 0.75rem; 184 | padding-bottom: 0.75rem; 185 | color: #6c757d; 186 | text-align: left; 187 | caption-side: bottom; 188 | } 189 | 190 | th { 191 | text-align: inherit; 192 | } 193 | 194 | label { 195 | display: inline-block; 196 | margin-bottom: 0.5rem; 197 | } 198 | 199 | button { 200 | border-radius: 0; 201 | } 202 | 203 | button:focus { 204 | outline: 1px dotted; 205 | outline: 5px auto -webkit-focus-ring-color; 206 | } 207 | 208 | input, 209 | button, 210 | select, 211 | optgroup, 212 | textarea { 213 | margin: 0; 214 | font-family: inherit; 215 | font-size: inherit; 216 | line-height: inherit; 217 | } 218 | 219 | button, 220 | input { 221 | overflow: visible; 222 | } 223 | 224 | button, 225 | select { 226 | text-transform: none; 227 | } 228 | 229 | select { 230 | word-wrap: normal; 231 | } 232 | 233 | button, 234 | [type="button"], 235 | [type="reset"], 236 | [type="submit"] { 237 | -webkit-appearance: button; 238 | } 239 | 240 | button:not(:disabled), 241 | [type="button"]:not(:disabled), 242 | [type="reset"]:not(:disabled), 243 | [type="submit"]:not(:disabled) { 244 | cursor: pointer; 245 | } 246 | 247 | button::-moz-focus-inner, 248 | [type="button"]::-moz-focus-inner, 249 | [type="reset"]::-moz-focus-inner, 250 | [type="submit"]::-moz-focus-inner { 251 | padding: 0; 252 | border-style: none; 253 | } 254 | 255 | input[type="radio"], 256 | input[type="checkbox"] { 257 | box-sizing: border-box; 258 | padding: 0; 259 | } 260 | 261 | input[type="date"], 262 | input[type="time"], 263 | input[type="datetime-local"], 264 | input[type="month"] { 265 | -webkit-appearance: listbox; 266 | } 267 | 268 | textarea { 269 | overflow: auto; 270 | resize: vertical; 271 | } 272 | 273 | fieldset { 274 | min-width: 0; 275 | padding: 0; 276 | margin: 0; 277 | border: 0; 278 | } 279 | 280 | legend { 281 | display: block; 282 | width: 100%; 283 | max-width: 100%; 284 | padding: 0; 285 | margin-bottom: .5rem; 286 | font-size: 1.5rem; 287 | line-height: inherit; 288 | color: inherit; 289 | white-space: normal; 290 | } 291 | 292 | progress { 293 | vertical-align: baseline; 294 | } 295 | 296 | [type="number"]::-webkit-inner-spin-button, 297 | [type="number"]::-webkit-outer-spin-button { 298 | height: auto; 299 | } 300 | 301 | [type="search"] { 302 | outline-offset: -2px; 303 | -webkit-appearance: none; 304 | } 305 | 306 | [type="search"]::-webkit-search-decoration { 307 | -webkit-appearance: none; 308 | } 309 | 310 | ::-webkit-file-upload-button { 311 | font: inherit; 312 | -webkit-appearance: button; 313 | } 314 | 315 | output { 316 | display: inline-block; 317 | } 318 | 319 | summary { 320 | display: list-item; 321 | cursor: pointer; 322 | } 323 | 324 | template { 325 | display: none; 326 | } 327 | 328 | [hidden] { 329 | display: none !important; 330 | } 331 | /*# sourceMappingURL=bootstrap-reboot.css.map */ 332 | -------------------------------------------------------------------------------- /inst/includes/stylesheets/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 The Bootstrap Authors 4 | * Copyright 2011-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} 8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */ 9 | -------------------------------------------------------------------------------- /inst/includes/stylesheets/summarytools-global.css: -------------------------------------------------------------------------------- 1 | .table { 2 | width: auto; 3 | } 4 | 5 | .table > tbody > tr > td { 6 | vertical-align: middle; 7 | } 8 | -------------------------------------------------------------------------------- /inst/includes/stylesheets/summarytools.css: -------------------------------------------------------------------------------- 1 | img { 2 | background-color: transparent; 3 | border: 0; 4 | } 5 | 6 | .st-table td, 7 | .st-table th { 8 | padding: 8px; 9 | } 10 | 11 | .st-table > thead > tr { 12 | background-color: #eeeeee; 13 | } 14 | 15 | .st-cross-table td { 16 | text-align: center; 17 | } 18 | 19 | .st-descr-table td { 20 | text-align: right; 21 | } 22 | 23 | table.st-table th { 24 | text-align: center; 25 | } 26 | 27 | table.st-table > thead > tr { 28 | background-color: #eeeeee; 29 | } 30 | 31 | table.st-table td span { 32 | display: block; 33 | } 34 | 35 | table.st-table > tfoot > tr > td { 36 | border:none; 37 | } 38 | 39 | .st-container { 40 | width: 100%; 41 | padding-right: 15px; 42 | padding-left: 15px; 43 | margin-right: auto; 44 | margin-left: auto; 45 | margin-top: 15px; 46 | } 47 | 48 | .st-multiline { 49 | white-space: pre; 50 | } 51 | 52 | .st-table { 53 | width: auto; 54 | table-layout: auto; 55 | margin-top: 20px; 56 | margin-bottom: 20px; 57 | max-width: 100%; 58 | background-color: transparent; 59 | border-collapse: collapse; 60 | } 61 | 62 | .st-table > thead > tr > th, 63 | .st-table > tbody > tr > th, 64 | .st-table > tfoot > tr > th, 65 | .st-table > thead > tr > td, 66 | .st-table > tbody > tr > td, 67 | .st-table > tfoot > tr > td { 68 | vertical-align: middle; 69 | } 70 | 71 | .st-table-bordered { 72 | border: 1px solid #bbbbbb; 73 | } 74 | 75 | .st-table-bordered > thead > tr > th, 76 | .st-table-bordered > tbody > tr > th, 77 | .st-table-bordered > thead > tr > td, 78 | .st-table-bordered > tbody > tr > td { 79 | border: 1px solid #cccccc; 80 | } 81 | 82 | .st-table-bordered > thead > tr > th, 83 | .st-table-bordered > thead > tr > td, 84 | .st-table thead > tr > th { 85 | border-bottom: none; 86 | } 87 | 88 | .st-freq-table > thead > tr > th, 89 | .st-freq-table > tbody > tr > th, 90 | .st-freq-table > tfoot > tr > th, 91 | .st-freq-table > thead > tr > td, 92 | .st-freq-table > tbody > tr > td, 93 | .st-freq-table > tfoot > tr > td, 94 | .st-freq-table-nomiss > thead > tr > th, 95 | .st-freq-table-nomiss > tbody > tr > th, 96 | .st-freq-table-nomiss > tfoot > tr > th, 97 | .st-freq-table-nomiss > thead > tr > td, 98 | .st-freq-table-nomiss > tbody > tr > td, 99 | .st-freq-table-nomiss > tfoot > tr > td, 100 | .st-cross-table > thead > tr > th, 101 | .st-cross-table > tbody > tr > th, 102 | .st-cross-table > tfoot > tr > th, 103 | .st-cross-table > thead > tr > td, 104 | .st-cross-table > tbody > tr > td, 105 | .st-cross-table > tfoot > tr > td { 106 | padding-left: 20px; 107 | padding-right: 20px; 108 | } 109 | 110 | .st-table-bordered > thead > tr > th, 111 | .st-table-bordered > tbody > tr > th, 112 | .st-table-bordered > thead > tr > td, 113 | .st-table-bordered > tbody > tr > td { 114 | border: 1px solid #cccccc; 115 | } 116 | 117 | .st-table-striped > tbody > tr:nth-of-type(odd) { 118 | background-color: #ffffff; 119 | } 120 | 121 | .st-table-striped > tbody > tr:nth-of-type(even) { 122 | background-color: #f9f9f9; 123 | } 124 | 125 | .st-descr-table > thead > tr > th, 126 | .st-descr-table > tbody > tr > th, 127 | .st-descr-table > thead > tr > td, 128 | .st-descr-table > tbody > tr > td { 129 | padding-left: 24px; 130 | padding-right: 24px; 131 | word-wrap: break-word; 132 | } 133 | 134 | .st-freq-table, 135 | .st-freq-table-nomiss, 136 | .st-cross-table { 137 | border: medium none; 138 | } 139 | 140 | .st-freq-table > thead > tr:nth-child(1) > th:nth-child(1), 141 | .st-cross-table > thead > tr:nth-child(1) > th:nth-child(1), 142 | .st-cross-table > thead > tr:nth-child(1) > th:nth-child(3) { 143 | border: none; 144 | background-color: #ffffff; 145 | text-align: center; 146 | } 147 | 148 | .st-protect-top-border { 149 | border-top: 1px solid #cccccc !important; 150 | } 151 | 152 | .st-ws-char { 153 | display: inline; 154 | color: #999999; 155 | letter-spacing: 0.2em; 156 | } 157 | 158 | /* Optional classes */ 159 | .st-small { 160 | font-size: 13px; 161 | } 162 | 163 | .st-small td, 164 | .st-small th { 165 | padding: 8px; 166 | } 167 | 168 | .st-small > thead > tr > th, 169 | .st-small > tbody > tr > th, 170 | .st-small > thead > tr > td, 171 | .st-small > tbody > tr > td { 172 | padding-left: 12px; 173 | padding-right: 12px; 174 | } 175 | -------------------------------------------------------------------------------- /man/cleartmp.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cleartmp.R 3 | \name{cleartmp} 4 | \alias{cleartmp} 5 | \title{Delete Temporary Html Files} 6 | \usage{ 7 | cleartmp(all = TRUE, silent = FALSE, verbose = FALSE) 8 | } 9 | \arguments{ 10 | \item{all}{Logical. When \code{TRUE} (default), all temporary summarytools 11 | files are deleted. When \code{FALSE}, only the latest file is.} 12 | 13 | \item{silent}{Logical. Hide confirmation messages (\code{FALSE} by default).} 14 | 15 | \item{verbose}{Logical. Display a message for every file that is deleted. 16 | \code{FALSE} by default.} 17 | } 18 | \description{ 19 | Delete temporary files created when using generic print method with 20 | \code{method='browser'} or \code{method='viewer'}, or when calling 21 | \code{view()} function. 22 | } 23 | \note{ 24 | Given that all temporary files are deleted automatically when an R 25 | session is ended, this function is an overkill in most circumstances. It 26 | could however be useful in server-type setups. 27 | } 28 | \author{ 29 | Dominic Comtois, \email{dominic.comtois@gmail.com} 30 | } 31 | \keyword{IO} 32 | -------------------------------------------------------------------------------- /man/ctable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ctable.R 3 | \name{ctable} 4 | \alias{ctable} 5 | \title{Cross-Tabulation} 6 | \usage{ 7 | ctable( 8 | x, 9 | y, 10 | prop = st_options("ctable.prop"), 11 | useNA = "ifany", 12 | totals = st_options("ctable.totals"), 13 | style = st_options("style"), 14 | round.digits = st_options("ctable.round.digits"), 15 | justify = "right", 16 | plain.ascii = st_options("plain.ascii"), 17 | headings = st_options("headings"), 18 | display.labels = st_options("display.labels"), 19 | split.tables = Inf, 20 | na.val = st_options("na.val"), 21 | rev = "none", 22 | dnn = c(substitute(x), substitute(y)), 23 | chisq = FALSE, 24 | OR = FALSE, 25 | RR = FALSE, 26 | weights = NA, 27 | rescale.weights = FALSE, 28 | ... 29 | ) 30 | } 31 | \arguments{ 32 | \item{x}{First categorical variable - values will appear as row names.} 33 | 34 | \item{y}{Second categorical variable - values will appear as column names.} 35 | 36 | \item{prop}{Character. Indicates which proportions to show: \dQuote{r} 37 | (rows, default), \dQuote{c} (columns), \dQuote{t} (total), or \dQuote{n} 38 | (none). Default value can be changed using \code{\link{st_options}}, 39 | option \code{ctable.prop}.} 40 | 41 | \item{useNA}{Character. One of \dQuote{ifany} (default), \dQuote{no}, or 42 | \dQuote{always}. This argument is passed on \sQuote{as is} to 43 | \code{\link[base]{table}}, or adapted for \code{\link[stats]{xtabs}} when 44 | weights are used.} 45 | 46 | \item{totals}{Logical. Show row and column totals. Defaults to 47 | \code{TRUE} but can be set globally with \code{\link{st_options}}, option 48 | \code{ctable.totals}.} 49 | 50 | \item{style}{Character. Style to be used by \code{\link[pander]{pander}}. One 51 | of \dQuote{simple} (default), \dQuote{grid}, \dQuote{rmarkdown}, or 52 | \dQuote{jira}. Can be set globally with \code{\link{st_options}}.} 53 | 54 | \item{round.digits}{Numeric. Number of significant digits to keep. Defaults 55 | to \code{1}. To change this default value, use \code{\link{st_options}}, 56 | option \code{ctable.round.digits}.} 57 | 58 | \item{justify}{Character. Horizontal alignment; one of \dQuote{l} (left), 59 | \dQuote{c} (center), or \dQuote{r} (right, default).} 60 | 61 | \item{plain.ascii}{Logical. Used by \code{\link[pander]{pander}}; when 62 | \code{TRUE}, no markup characters are generated (useful when printing 63 | to console). Defaults to \code{TRUE} unless \code{style = 'rmarkdown'}, 64 | in which case it is set to \code{FALSE} automatically. To change the 65 | default value globally, use \code{\link{st_options}}.} 66 | 67 | \item{headings}{Logical. Show heading section. \code{TRUE} by default; can be 68 | set globally with \code{\link{st_options}}.} 69 | 70 | \item{display.labels}{Logical. Display data frame label in the heading 71 | section. \code{TRUE} by default, can be changed globally with 72 | \code{\link{st_options}}.} 73 | 74 | \item{split.tables}{Numeric. \code{\link[pander]{pander}} argument that 75 | specifies how many characters wide a table can be. \code{Inf} by default.} 76 | 77 | \item{na.val}{Character. For factors and character vectors, consider this 78 | value as \code{NA}. Ignored if there are actual NA values or if it matches 79 | no value / factor level in the data. \code{NULL} by default.} 80 | 81 | \item{rev}{Character. Dimension(s) to reverse for calculation 82 | of risk/odds ratios. One of \dQuote{rows} / \dQuote{r}, \dQuote{columns} / 83 | \dQuote{c}, \dQuote{both} / \dQuote{b}, or \dQuote{none} / \dQuote{n} 84 | (default). See \emph{details}.} 85 | 86 | \item{dnn}{Character vector. Variable names to be used in output table. In 87 | most cases, setting this parameter is not required as the names are 88 | automatically generated.} 89 | 90 | \item{chisq}{Logical. Display chi-square statistic along with p-value.} 91 | 92 | \item{OR}{Logical or numeric. Set to \code{TRUE} to show odds ratio with 95% 93 | confidence interval, or specify confidence level explicitly (\emph{e.g.}, 94 | \code{.90}). CI's are calculated using Wald's method of normal approximation.} 95 | 96 | \item{RR}{Logical or numeric. Set to \code{TRUE} to show risk ratio (also 97 | called \emph{relative risk} with 95% confidence interval, or specify 98 | confidence level explicitly (\emph{e.g.} \code{.90}). CI's are 99 | calculated using Wald's method of normal approximation.} 100 | 101 | \item{weights}{Numeric. Vector of weights; must have the same length as 102 | \code{x}.} 103 | 104 | \item{rescale.weights}{Logical. When \code{TRUE}, a global constant is 105 | applied so that the sum of counts equals \code{nrow(x)}. \code{FALSE} by 106 | default.} 107 | 108 | \item{\dots}{Additional arguments passed to \code{\link[pander]{pander}} or 109 | \code{\link[base]{format}}.} 110 | } 111 | \value{ 112 | A list containing two matrices, \emph{cross_table} and 113 | \emph{proportions}. The \emph{print} method takes care of assembling 114 | figures from those matrices into a single table. The returned object has 115 | classes \dQuote{\emph{summarytools}} and \dQuote{\emph{list}}, unless 116 | \code{\link[summarytools]{stby}} is used, in which case we have an 117 | object of class \dQuote{\emph{stby}}. 118 | } 119 | \description{ 120 | Cross-tabulation for a pair of categorical variables with either 121 | row, column, or total proportions, as well as marginal sums. Works with 122 | numeric, character, as well as factor variables. 123 | } 124 | \details{ 125 | For risk ratios and odds ratios, the expected structure of the contingency 126 | table is as follows (using \dQuote{No} as reference): 127 | 128 | \preformatted{ 129 | Outcome 130 | Exposure Yes No 131 | Yes a b 132 | No c d 133 | } 134 | 135 | The \emph{rev} parameter allows for different structures; use either one of 136 | \dQuote{rows}, \dQuote{columns}, or \dQuote{both} to indicate which 137 | dimension(s) to reverse in order to match that structure. This does 138 | \emph{not} affect display. 139 | } 140 | \note{ 141 | Markdown does not fully support multi-header tables; 142 | until such support is available, the recommended way to display 143 | cross-tables in .Rmd documents is to use `method=render`. See package 144 | vignettes for examples. 145 | } 146 | \examples{ 147 | data("tobacco") 148 | ctable(tobacco$gender, tobacco$smoker) 149 | 150 | # Use with() to simplify syntax 151 | with(tobacco, ctable(gender, smoker)) 152 | 153 | # Show column proportions, without totals 154 | with(tobacco, ctable(smoker, diseased, prop = "c", totals = FALSE)) 155 | 156 | # Simple 2 x 2 table with odds ratio and risk ratio 157 | with(tobacco, ctable(smoker, diseased, totals = FALSE, headings = FALSE, 158 | prop = "r", OR = TRUE, RR = TRUE)) 159 | 160 | # Grouped cross-tabulations 161 | with(tobacco, stby(data = list(x = smoker, y = diseased), 162 | INDICES = gender, FUN = ctable)) 163 | 164 | 165 | \dontrun{ 166 | ct <- ctable(tobacco$gender, tobacco$smoker) 167 | 168 | # Show html results in browser 169 | print(ct, method = "browser") 170 | 171 | # Save results to html file 172 | print(ct, file = "ct_gender_smoker.html") 173 | 174 | # Save results to text file 175 | print(ct, file = "ct_gender_smoker.txt") 176 | } 177 | } 178 | \seealso{ 179 | \code{\link[base]{table}}, \code{\link[stats]{xtabs}} 180 | } 181 | \author{ 182 | Dominic Comtois, \email{dominic.comtois@gmail.com} 183 | } 184 | \keyword{category} 185 | \keyword{classes} 186 | -------------------------------------------------------------------------------- /man/define_keywords.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/define_keywords.R 3 | \name{define_keywords} 4 | \alias{define_keywords} 5 | \title{Modify Keywords Used In Outputs} 6 | \usage{ 7 | define_keywords(..., ask = TRUE, file = NA) 8 | } 9 | \arguments{ 10 | \item{\dots}{One or more pairs of keywords and their new values see 11 | \emph{Details} for the complete list of existing keywords.} 12 | 13 | \item{ask}{Logical. When `TRUE` (default), a dialog box comes up to ask 14 | whether to save the edited values in a csv file for later use.} 15 | 16 | \item{file}{Character. Path and name of custom language file to be saved. 17 | This comma delimited file can be reused by calling 18 | \code{\link{use_custom_lang}}. Must have \emph{.csv} extension.} 19 | } 20 | \description{ 21 | As an alternative to \code{\link{use_custom_lang}}, this function allows 22 | temporarily modifying the pre-defined terms in the outputs. 23 | } 24 | \details{ 25 | On systems with GUI capabilities, a window will pop-up when calling 26 | \code{define_keywords()} without any parameters, allowing the modification 27 | of the \emph{custom} column. The changes will be active as long as the 28 | package is loaded. When the edit window is closed, a dialog will pop up, 29 | prompting the user to save the modified set of keywords in a custom csv 30 | language file that can later be used with \code{\link{use_custom_lang}}. 31 | 32 | Here is the full list of modifiable keywords. 33 | 34 | \describe{ 35 | \item{title.freq}{main heading for \code{freq()}} 36 | \item{title.freq.weighted}{main heading for \code{freq()} (weighted)} 37 | \item{title.ctable}{main heading for \code{ctable()}} 38 | \item{title.ctable.weighted}{main heading \code{ctable()} (weighted)} 39 | \item{title.ctable.row}{indicates what proportions are displayed} 40 | \item{title.ctable.col}{indicates what proportions are displayed} 41 | \item{title.ctable.tot}{indicates what proportions are displayed} 42 | \item{title.descr}{main heading for \code{descr()}} 43 | \item{title.descr.weighted}{main heading for \code{descr()} (weighted)} 44 | \item{title.dfSummary}{main heading for \code{dfSummary()}} 45 | \item{n}{heading item used in \code{descr()}} 46 | \item{dimensions}{heading item used in \code{dfSummary()}} 47 | \item{duplicates}{heading item used in \code{dfSummary()}} 48 | \item{data.frame}{heading item (all functions)} 49 | \item{label}{heading item (all functions) & column name in \code{dfSummary()}} 50 | \item{variable}{heading item (all functions) & column name in \code{dfSummary()}} 51 | \item{group}{heading item (all functions when used with \code{stby()}} 52 | \item{by}{heading item for \code{descr()} when used with stby()} 53 | \item{weights}{heading item - \code{descr()} & \code{freq()}} 54 | \item{type}{heading item for \code{freq()}} 55 | \item{logical}{heading item - type in \code{freq()}} 56 | \item{character}{heading item - type in \code{freq()}} 57 | \item{numeric}{heading item - type in \code{freq()}} 58 | \item{factor}{heading item - type in \code{freq()}} 59 | \item{factor.ordered}{heading item - type in \code{freq()}} 60 | \item{date}{heading item - type in \code{freq()}} 61 | \item{datetime}{heading item - type in \code{freq()}} 62 | \item{freq}{column name in \code{freq()}} 63 | \item{pct}{column name in \code{freq()} when \code{report.nas=FALSE}} 64 | \item{pct.valid.f}{column name in \code{freq()}} 65 | \item{pct.valid.cum}{column name in \code{freq()}} 66 | \item{pct.total}{column name in \code{freq()}} 67 | \item{pct.total.cum}{column name in \code{freq()}} 68 | \item{pct.cum}{column name in \code{freq()}} 69 | \item{valid}{column name in \code{freq()} and \code{dfSummary()} & column content in \code{dfSummary()}} 70 | \item{invalid}{column content in \code{dfSummary()} (emails)} 71 | \item{total}{column grouping in \code{freq()}, html version} 72 | \item{mean}{row name in \code{descr()}} 73 | \item{sd.long}{row name in \code{descr()}} 74 | \item{sd}{cell content (dfSummary)} 75 | \item{min}{row name in \code{descr()}} 76 | \item{q1}{row name in \code{descr()} - 1st quartile} 77 | \item{med}{row name in \code{descr()}} 78 | \item{q3}{row name in \code{descr()} - 3rd quartile} 79 | \item{max}{row name in \code{descr()}} 80 | \item{mad}{row name in \code{descr()} - Median Absolute Deviation} 81 | \item{iqr}{row name in \code{descr()} - Inter-Quartile Range} 82 | \item{cv}{row name in \code{descr()} - Coefficient of Variation} 83 | \item{skewness}{row name in \code{descr()}} 84 | \item{se.skewness}{row name in \code{descr()} - Std. Error for Skewness} 85 | \item{kurtosis}{row name in \code{descr()}} 86 | \item{n.valid}{row name in \code{descr()} - Count of non-missing values} 87 | \item{pct.valid}{row name in \code{descr()} - pct. of non-missing values} 88 | \item{no}{column name in \code{dfSummary()} - position of column in the data frame} 89 | \item{stats.values}{column name in \code{dfSummary()}} 90 | \item{freqs.pct.valid}{column name in \code{dfSummary()}} 91 | \item{graph}{column name in \code{dfSummary()}} 92 | \item{missing}{column name in \code{dfSummary()}} 93 | \item{distinct.value}{cell content in \code{dfSummary()} - singular form} 94 | \item{distinct.values}{cell content in \code{dfSummary()} - plural form} 95 | \item{all.nas}{cell content in \code{dfSummary()} - column has only NAs} 96 | \item{all.empty.str}{cell content in \code{dfSummary()} - column has only empty strings} 97 | \item{all.empty.str.nas}{cell content in \code{dfSummary()} - col. has only NAs and empty strings} 98 | \item{no.levels.defined}{cell content in \code{dfSummary()} - factor has no levels defined} 99 | \item{int.sequence}{cell content in \code{dfSummary()}} 100 | \item{rounded}{cell content in \code{dfSummary()} - note appearing in Stats/Values} 101 | \item{others}{cell content in \code{dfSummary()} - nbr of values not displayed} 102 | \item{codes}{cell content in \code{dfSummary()} - When UPC codes are detected} 103 | \item{mode}{cell content in \code{dfSummary()} - mode = most frequent value} 104 | \item{med.short}{cell content in \code{dfSummary()} - median (shortened term)} 105 | \item{start}{cell content in \code{dfSummary()} - earliest date for date-type cols} 106 | \item{end}{cell content in \code{dfSummary()} - latest date for data-type cols} 107 | \item{emails}{cell content in \code{dfSummary()}} 108 | \item{generated.by}{footnote content} 109 | \item{version}{footnote content} 110 | \item{date.fmt}{footnote - date format (see \code{\link{strptime}})} 111 | } 112 | } 113 | \note{ 114 | Setting a keyword starting with \dQuote{title.} to NA or to empty 115 | string causes the main title to disappear altogether, which might be 116 | desired in some circumstances (when generating a table of contents, for 117 | instance). 118 | } 119 | \examples{ 120 | \dontrun{ 121 | define_keywords(n = "Nb. Obs.") 122 | } 123 | 124 | } 125 | \keyword{utilities} 126 | -------------------------------------------------------------------------------- /man/descr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/descr.R 3 | \name{descr} 4 | \alias{descr} 5 | \title{Univariate Statistics for Numerical Data} 6 | \usage{ 7 | descr( 8 | x, 9 | var = NULL, 10 | stats = st_options("descr.stats"), 11 | na.rm = TRUE, 12 | round.digits = st_options("round.digits"), 13 | transpose = st_options("descr.transpose"), 14 | order = "sort", 15 | style = st_options("style"), 16 | plain.ascii = st_options("plain.ascii"), 17 | justify = "r", 18 | headings = st_options("headings"), 19 | display.labels = st_options("display.labels"), 20 | split.tables = 100, 21 | weights = NULL, 22 | rescale.weights = FALSE, 23 | ... 24 | ) 25 | } 26 | \arguments{ 27 | \item{x}{A numerical vector or a data frame.} 28 | 29 | \item{var}{Unquoted expression referring to a specific column in \code{x}. 30 | Provides support for piped function calls (e.g. 31 | \code{my_df |> descr(my_var)}.} 32 | 33 | \item{stats}{Character. Which stats to produce. Either \dQuote{all} (default), 34 | \dQuote{fivenum}, \dQuote{common} (see \emph{Details}), or a selection of : 35 | \dQuote{mean}, \dQuote{sd}, \dQuote{min}, \dQuote{q1}, \dQuote{med}, 36 | \dQuote{q3}, \dQuote{max}, \dQuote{mad}, \dQuote{iqr}, \dQuote{cv}, 37 | \dQuote{skewness}, \dQuote{se.skewness}, \dQuote{kurtosis}, 38 | \dQuote{n.valid}, \dQuote{n}, and \dQuote{pct.valid}. Can be set globally 39 | via \code{\link{st_options}}, option \dQuote{descr.stats}. See 40 | \emph{Details}.} 41 | 42 | \item{na.rm}{Logical. Argument to be passed to statistical functions. 43 | Defaults to \code{TRUE}.} 44 | 45 | \item{round.digits}{Numeric. Number of significant digits to display. 46 | Defaults to \code{2}. Can be set globally with \code{\link{st_options}}.} 47 | 48 | \item{transpose}{Logical. Make variables appears as columns, and stats as 49 | rows. Defaults to \code{FALSE}. Can be set globally with 50 | \code{\link{st_options}}, option \dQuote{descr.transpose}.} 51 | 52 | \item{order}{Character. When analyzing more than one variable, this parameter 53 | determines how to order variables. Valid values are \dQuote{sort} (or 54 | simply \dQuote{s}), \dQuote{preserve} (or \dQuote{p}), or a vector 55 | containing all variable names in the desired order. Defaults to 56 | \dQuote{sort}.} 57 | 58 | \item{style}{Character. Style to be used by \code{\link[pander]{pander}}. One 59 | of \dQuote{simple} (default), \dQuote{grid}, \dQuote{rmarkdown}, or 60 | \dQuote{jira}. Can be set globally with \code{\link{st_options}}.} 61 | 62 | \item{plain.ascii}{Logical. \code{\link[pander]{pander}} argument; when 63 | \code{TRUE} (default), no markup characters will be used (useful when 64 | printing to console). If \code{style = 'rmarkdown'} is specified, value 65 | is set to \code{FALSE} automatically. Can be set globally using 66 | \code{\link{st_options}}.} 67 | 68 | \item{justify}{Character. Alignment of numbers in cells; \dQuote{l} for left, 69 | \dQuote{c} for center, or \dQuote{r} for right (default). Has no effect on 70 | \emph{html} tables.} 71 | 72 | \item{headings}{Logical. Set to \code{FALSE} to omit heading section. Can be 73 | set globally via \code{\link{st_options}}. \code{TRUE} by default.} 74 | 75 | \item{display.labels}{Logical. Show variable / data frame labels in heading 76 | section. Defaults to \code{TRUE}. Can be set globally with 77 | \code{\link{st_options}}.} 78 | 79 | \item{split.tables}{Character. \code{\link[pander]{pander}} argument that 80 | specifies how many characters wide a table can be. \code{100} by default.} 81 | 82 | \item{weights}{Numeric. Vector of weights having same length as \emph{x}. 83 | \code{NULL} (default) indicates that no weights are used.} 84 | 85 | \item{rescale.weights}{Logical. When set to \code{TRUE}, a global constant is 86 | apply to make the total count equal \code{nrow(x)}. \code{FALSE} by default.} 87 | 88 | \item{\dots}{Additional arguments passed to \code{\link[pander]{pander}} or 89 | \code{\link[base]{format}}.} 90 | } 91 | \value{ 92 | An object having classes \dQuote{\emph{matrix}} and 93 | \dQuote{\emph{summarytools}} containing the statistics, with extra 94 | attributes useful to other functions/methods. 95 | } 96 | \description{ 97 | Calculates mean, sd, min, Q1\*, median, Q3\*, max, MAD, IQR\*, CV, 98 | skewness\*, SE.skewness\*, and kurtosis\* on numerical vectors. (\*) Not 99 | available when using sampling weights. 100 | } 101 | \details{ 102 | Since version 1.1, the \emph{stats} argument can be set in a more flexible 103 | way; keywords (\emph{all}, \emph{common}, \emph{fivenum}) can be combined 104 | with single statistics, or their \dQuote{negation}. For instance, using 105 | \code{stats = c("all", "-q1", "-q3")} would show 106 | \strong{all except q1 and q3}. 107 | 108 | For further customization, you could redefine any preset in the 109 | following manner: \code{.st_env$descr.stats$common <- c("mean", "sd", "n")}. 110 | \emph{Use caution when modifying \code{.st_env}, and reload the package 111 | if errors ensue. Changes are temporary and will not persist across 112 | R sessions.} 113 | } 114 | \examples{ 115 | data("exams") 116 | 117 | # All stats (default behavior) for all numerical variables 118 | descr(exams) 119 | 120 | # Show only "common" statistics, plus "n" 121 | descr(exams, stats = c("common", "n")) 122 | 123 | # Selection of statistics, transposing the results 124 | descr(exams, stats = c("mean", "sd", "min", "max"), transpose = TRUE) 125 | 126 | # Rmarkdown-ready 127 | descr(exams, plain.ascii = FALSE, style = "rmarkdown") 128 | 129 | # Grouped statistics 130 | data("tobacco") 131 | with(tobacco, stby(BMI, gender, descr, check.nas = FALSE)) 132 | 133 | # Grouped statistics in tidy table: 134 | tb(with(tobacco, stby(BMI, age.gr, descr, stats = "common"))) 135 | 136 | \dontrun{ 137 | # Show in Viewer (or browser if not in RStudio) 138 | view(descr(exams)) 139 | 140 | # Save to html file with title 141 | print(descr(exams), 142 | file = "descr_exams.html", 143 | report.title = "BMI by Age Group", 144 | footnote = "Schoolyear: 2018-2019
Semester: Fall") 145 | } 146 | 147 | } 148 | \author{ 149 | Dominic Comtois, \email{dominic.comtois@gmail.com} 150 | } 151 | \keyword{univar} 152 | -------------------------------------------------------------------------------- /man/examens.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/examens.R 3 | \docType{data} 4 | \name{examens} 5 | \alias{examens} 6 | \title{Bulletin de notes (donnees simulees)} 7 | \format{ 8 | Un data frame de 30 rangees et 8 colonnes 9 | } 10 | \usage{ 11 | data(examens) 12 | } 13 | \description{ 14 | Jeu de donnees simulees contenant les notes de 30 etudiants, avec les 15 | colonnes suivantes: 16 | \itemize{ 17 | \item etudiant Nom de l'etudiant. 18 | \item sexe Variable categorielle (facteur). Deux niveaux: \dQuote{Fille}, 19 | \dQuote{Garcon}. 20 | \item francais Note en francais (numerique). 21 | \item math Note en maths (numerique). 22 | \item geographie Note en geographie (numerique). 23 | \item histoire Note en histoire (numerique). 24 | \item economie Note en economie (numerique). 25 | \item anglais Note en anglais (numerique). 26 | } 27 | } 28 | \details{ 29 | Donnees simulees. Les notes de chaque etudiant sont centrees autour d'une 30 | moyenne personnelle et ecart-type randomises. 31 | 32 | A copy of this dataset is \strong{available in English} under the name 33 | \dQuote{exams}. 34 | } 35 | \keyword{datasets} 36 | -------------------------------------------------------------------------------- /man/exams.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/exams.R 3 | \docType{data} 4 | \name{exams} 5 | \alias{exams} 6 | \title{Report Cards - Simulated Data} 7 | \format{ 8 | A data frame with 30 rows and 8 variables 9 | } 10 | \usage{ 11 | data(exams) 12 | } 13 | \description{ 14 | A simulated dataset with grades for hypothetical 30 students, with 15 | the following variables: 16 | \itemize{ 17 | \item student Student's name. 18 | \item gender Factor with 2 levels: \dQuote{Girl}, \dQuote{Boy}. 19 | \item french French Grade (numerical). 20 | \item math Math Grade (numerical). 21 | \item geography Geography Grade (numerical). 22 | \item history History Grade (numerical). 23 | \item economics Economics Grade (numerical). 24 | \item english English Grade (numerical). 25 | } 26 | } 27 | \details{ 28 | All names and grades are simulated. Grades for each student are centered 29 | around a personal randomized average and standard deviation. 30 | 31 | A copy of this dataset is also \strong{available in French} under 32 | the name \dQuote{examens}. 33 | } 34 | \keyword{datasets} 35 | -------------------------------------------------------------------------------- /man/format_number.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dfSummary.R 3 | \name{format_number} 4 | \alias{format_number} 5 | \title{format_number} 6 | \usage{ 7 | format_number(x, round.digits, ...) 8 | } 9 | \arguments{ 10 | \item{x}{A numerical value to be formatted.} 11 | 12 | \item{round.digits}{Numerical. Number of decimals to show. Used to define 13 | both \code{digits} and \code{nsmall} when calling \code{\link{format}}.} 14 | 15 | \item{\dots}{Any other formatting instruction that is compatible with 16 | \code{\link{format}}.} 17 | } 18 | \description{ 19 | Used internally (not exported) to apply all relevant formatting. It is 20 | documented here only because it can be used when setting the 21 | \code{dfSummary.custom.1} and \code{dfSummary.custom.1} options. 22 | } 23 | \examples{ 24 | 25 | \dontrun{ 26 | format_number(IQR(column_data, na.rm = TRUE), round.digits) 27 | format_number(IQR(column_data, na.rm = TRUE), decimal.mark = ",") 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /man/freq.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/freq.R 3 | \name{freq} 4 | \alias{freq} 5 | \title{Frequency Tables for Factors and Other Discrete Data} 6 | \usage{ 7 | freq( 8 | x, 9 | var = NULL, 10 | round.digits = st_options("round.digits"), 11 | order = "default", 12 | style = st_options("style"), 13 | plain.ascii = st_options("plain.ascii"), 14 | justify = "default", 15 | cumul = st_options("freq.cumul"), 16 | totals = st_options("freq.totals"), 17 | report.nas = st_options("freq.report.nas"), 18 | rows = numeric(), 19 | missing = "", 20 | na.val = st_options("na.val"), 21 | display.type = TRUE, 22 | display.labels = st_options("display.labels"), 23 | headings = st_options("headings"), 24 | weights = NA, 25 | rescale.weights = FALSE, 26 | ... 27 | ) 28 | } 29 | \arguments{ 30 | \item{x}{Factor, vector, or data frame.} 31 | 32 | \item{var}{Optional unquoted variable name. Provides support for piped 33 | function calls (e.g. \code{my_df \%>\% freq(my_var)}).} 34 | 35 | \item{round.digits}{Numeric. Number of significant digits to display. 36 | Defaults to \code{2}. Can be set globally with \code{\link{st_options}}.} 37 | 38 | \item{order}{Character. Ordering of rows in frequency table; \dQuote{name} 39 | (default for non-factors), \dQuote{level} (default for factors), or 40 | \dQuote{freq} (from most frequent to less frequent). To invert the order, 41 | place a minus sign before or after the word. \dQuote{-freq} will thus 42 | display the items starting from the lowest in frequency to the highest, 43 | and so forth.} 44 | 45 | \item{style}{Character. Style to be used by \code{\link[pander]{pander}}. One 46 | of \dQuote{simple} (default), \dQuote{grid}, \dQuote{rmarkdown}, or 47 | \dQuote{jira}. Can be set globally with \code{\link{st_options}}.} 48 | 49 | \item{plain.ascii}{Logical. \code{\link[pander]{pander}} argument; when 50 | \code{TRUE}, no markup characters will be used (useful when printing to 51 | console). Defaults to \code{TRUE} unless \code{style = 'rmarkdown'}, in 52 | which case it will be set to \code{FALSE} automatically. Can be set 53 | globally with \code{\link{st_options}}.} 54 | 55 | \item{justify}{String indicating alignment of columns. By default 56 | (\dQuote{default}), \dQuote{right} is used for text tables and 57 | \dQuote{center} is used for \emph{html} tables. You can force it to one of 58 | \dQuote{left}, \dQuote{center}, or \dQuote{right}.} 59 | 60 | \item{cumul}{Logical. Set to \code{FALSE} to hide cumulative proportions 61 | from results. \code{TRUE} by default. To change this value globally, see 62 | \code{\link{st_options}}.} 63 | 64 | \item{totals}{Logical. Set to \code{FALSE} to hide totals from results. 65 | \code{TRUE} by default. To change this value globally, see 66 | \code{\link{st_options}}.} 67 | 68 | \item{report.nas}{Logical. Set to \code{FALSE} to turn off reporting of 69 | missing values. To change this default value globally, see 70 | \code{\link{st_options}}.} 71 | 72 | \item{rows}{Character or numeric vector allowing subsetting of the results. 73 | The order given here will be reflected in the resulting table. If a single 74 | string is used, it will be used as a regular expression to filter row 75 | names.} 76 | 77 | \item{missing}{Text to display in NA cells. Defaults to \dQuote{}.} 78 | 79 | \item{na.val}{Character. For factors and character vectors, consider this 80 | value as \code{NA}. Ignored if there are actual NA values or if it matches 81 | no value / factor level in the data. \code{NULL} by default.} 82 | 83 | \item{display.type}{Logical. Should variable type be displayed? Default is 84 | \code{TRUE}.} 85 | 86 | \item{display.labels}{Logical. Should variable / data frame labels be 87 | displayed? Default is \code{TRUE}. To change this default value globally, 88 | see \code{\link{st_options}}.} 89 | 90 | \item{headings}{Logical. Set to \code{FALSE} to omit heading section. Can be 91 | set globally via \code{\link{st_options}}.} 92 | 93 | \item{weights}{Vector of weights; must be of the same length as \code{x}.} 94 | 95 | \item{rescale.weights}{Logical parameter. When set to \code{TRUE}, the total 96 | count will be the same as the unweighted \code{x}. \code{FALSE} by default.} 97 | 98 | \item{\dots}{Additional arguments passed to \code{\link[pander]{pander}}.} 99 | } 100 | \value{ 101 | A frequency table of class \code{matrix} and \code{summarytools} with 102 | added attributes used by \emph{print} method. 103 | } 104 | \description{ 105 | Displays weighted or unweighted frequencies, including counts and 106 | proportions. 107 | } 108 | \details{ 109 | The default \code{plain.ascii = TRUE} option is there to make 110 | results appear cleaner in the console. To avoid rmarkdown rendering 111 | problems, this option is automatically set to \code{FALSE} whenever 112 | \code{style = "rmarkdown"} (unless \code{plain.ascii = TRUE} is made 113 | explicit in the function call). 114 | } 115 | \note{ 116 | The data type represents the \code{\link[base]{class}} in most cases. 117 | } 118 | \examples{ 119 | data(tobacco) 120 | freq(tobacco$gender) 121 | freq(tobacco$gender, totals = FALSE) 122 | 123 | # Ignore NA's, don't show totals, omit headings 124 | freq(tobacco$gender, report.nas = FALSE, totals = FALSE, headings = FALSE) 125 | 126 | # In .Rmd documents, use the two following arguments, minimally 127 | freq(tobacco$gender, style="rmarkdown", plain.ascii = FALSE) 128 | 129 | # Grouped Frequencies 130 | with(tobacco, stby(diseased, smoker, freq)) 131 | (fr_smoker_by_gender <- with(tobacco, stby(smoker, gender, freq))) 132 | 133 | # Print html Source 134 | print(fr_smoker_by_gender, method = "render", footnote = NA) 135 | 136 | # Order by frequency (+ to -) 137 | freq(tobacco$age.gr, order = "freq") 138 | 139 | # Order by frequency (- to +) 140 | freq(tobacco$age.gr, order = "-freq") 141 | 142 | # Use the 'rows' argument to display only the 10 most common items 143 | freq(tobacco$age.gr, order = "freq", rows = 1:10) 144 | 145 | \dontrun{ 146 | # Display rendered html results in RStudio's Viewer 147 | # notice 'view()' is NOT written with capital V 148 | # If working outside RStudio, Web browser is used instead 149 | # A temporary file is stored in temp dir 150 | view(fr_smoker_by_gender) 151 | 152 | # Display rendered html results in default Web browser 153 | # A temporary file is stored in temp dir here too 154 | print(fr_smoker_by_gender, method = "browser") 155 | 156 | # Write results to text file (.txt, .md, .Rmd) or html file (.html) 157 | print(fr_smoker_by_gender, method = "render", file = "fr_smoker_by_gender.md) 158 | print(fr_smoker_by_gender, method = "render", file = "fr_smoker_by_gender.html) 159 | } 160 | 161 | } 162 | \seealso{ 163 | \code{\link[base]{table}} 164 | } 165 | \author{ 166 | Dominic Comtois, \email{dominic.comtois@gmail.com} 167 | } 168 | \keyword{category} 169 | \keyword{classes} 170 | \keyword{univar} 171 | -------------------------------------------------------------------------------- /man/label.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/label.R 3 | \name{label} 4 | \alias{label} 5 | \alias{label<-} 6 | \alias{llabel} 7 | \title{Get or Set Variable or Data Frame Labels} 8 | \usage{ 9 | label(x, all = FALSE, fallback = FALSE, simplify = FALSE) 10 | label(x) <- value 11 | llabel(x, all = TRUE, fallback = FALSE, simplify = FALSE) 12 | } 13 | \arguments{ 14 | \item{x}{An R object to extract labels from.} 15 | 16 | \item{all}{Logical. When x is a data frame, setting this argument to 17 | \code{TRUE} will make the function return all variable labels. By 18 | default, its value is \code{FALSE}, so that if x is a data frame, it is 19 | the data frame's label itself that will be returned.} 20 | 21 | \item{fallback}{a logical value indicating if labels (returned values) 22 | should fallback to object name(s). Defaults to \code{FALSE}.} 23 | 24 | \item{simplify}{When x is a data frame and \code{all = TRUE}, coerce 25 | results to a vector and remove \code{NA}'s. Default is \code{FALSE}.} 26 | 27 | \item{value}{String to be used as label. To clear existing labels, use 28 | \code{NA} or \code{NULL}.} 29 | } 30 | \value{ 31 | A single character vector if \code{all = FALSE} (default), 32 | or a named list if \code{all = TRUE} (named vector when using 33 | \code{simplify = TRUE}. 34 | } 35 | \description{ 36 | Assigns a label to a vector or data frame, or returns value stored 37 | in the object's \code{label} attribute (or \code{NA} if none exists). 38 | } 39 | \details{ 40 | The wrapper function \code{llabel} was named that way to avoid conflicting 41 | with base function \code{\link[base]{labels}}. 42 | } 43 | \note{ 44 | Loosely based on Gergely Daróczi's \code{\link[rapportools]{label}} 45 | function. 46 | } 47 | \author{ 48 | Dominic Comtois, \email{dominic.comtois@gmail.com}, 49 | } 50 | -------------------------------------------------------------------------------- /man/parse_call.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/parse_call.R 3 | \name{parse_call} 4 | \alias{parse_call} 5 | \title{Extract Data Information From Arguments Passed to Functions (internal)} 6 | \usage{ 7 | parse_call( 8 | mc, 9 | var = "x", 10 | df_name = TRUE, 11 | df_label = TRUE, 12 | var_name = TRUE, 13 | var_label = TRUE, 14 | caller = "", 15 | silent = TRUE 16 | ) 17 | } 18 | \arguments{ 19 | \item{var}{Character. \dQuote{x} (default) or \dQuote{y} (the latter 20 | being used only in \code{\link{ctable}}).} 21 | 22 | \item{df_name}{Logical.} 23 | 24 | \item{df_label}{Logical.} 25 | 26 | \item{var_name}{Logical.} 27 | 28 | \item{var_label}{Logical.} 29 | 30 | \item{silent}{Logical. Hide console messages. \code{TRUE} by default.} 31 | } 32 | \value{ 33 | A list consisting of one or many of the following items 34 | \itemize{ 35 | \item df_name The data frame name 36 | \item df_label The data frame label 37 | \item var_name The variable name(s) 38 | \item var_label The variable label 39 | \item by_var The variable used in \code{by()}, when in the call stack 40 | \item by_group The group, when \code{by()} was used 41 | \item by_first Binary indicator used when \code{by()} is in the call stack 42 | \item by_last Binary indicator} 43 | } 44 | \description{ 45 | Using sys.calls(), sys.frames() and match.call(), this utility function 46 | extracts and/or infers information about the data being processed. 47 | Data frame name, variable names and labels if any, subsetting information, 48 | grouping information (when by() is used) are returned by the function which 49 | tries various methods to get this information. 50 | } 51 | \author{ 52 | Dominic Comtois, \email{dominic.comtois@gmail.com} 53 | } 54 | \keyword{internal} 55 | \keyword{misc} 56 | -------------------------------------------------------------------------------- /man/print.list.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print.list.R 3 | \name{print.list} 4 | \alias{print.list} 5 | \title{Print Method for Objects of Class \dQuote{list}} 6 | \usage{ 7 | \method{print}{list}(x, method = "pander", file = "", 8 | append = FALSE, report.title = NA, table.classes = NA, 9 | bootstrap.css = st_options('bootstrap.css'), 10 | custom.css = st_options('custom.css'), silent = FALSE, 11 | footnote = st_options('footnote'), collapse = 0, 12 | escape.pipe = st_options('escape.pipe'), \dots) 13 | } 14 | \arguments{ 15 | \item{x}{A \emph{summarytools} object, created by one of the four core 16 | functions (\code{\link{freq}}, \code{\link{descr}}, \code{\link{ctable}}, 17 | or \code{\link{dfSummary}}).} 18 | 19 | \item{method}{Character. One of \dQuote{pander}, \dQuote{viewer}, 20 | \dQuote{browser}, or \dQuote{render}. Default value for the \code{print()} 21 | method is \dQuote{pander}; for \code{view()}/\code{stview()}, default is 22 | \dQuote{viewer} if session is running in \emph{RStudio}, \dQuote{browser} 23 | otherwise. The main use for \dQuote{render} is in \emph{R Markdown} 24 | documents.} 25 | 26 | \item{file}{Character. File name to write output to. Defaults to \dQuote{}.} 27 | 28 | \item{append}{Logical. Append output to existing file (specified using the 29 | \emph{file} argument). \code{FALSE} by default.} 30 | 31 | \item{report.title}{Character. For \emph{html} reports, this goes into the 32 | \code{} tag. When left to \code{NA} (default), the first line of the 33 | heading section is used (\emph{e.g.}: \dQuote{Data Frame Summary}).} 34 | 35 | \item{table.classes}{Character. Additional \emph{html} classes to assign to 36 | output tables. \emph{Bootstrap css} classes can be used. User-defined 37 | classes (see the \emph{custom.css} argument) are also specified here. See 38 | \emph{details} section. \code{NA} by default.} 39 | 40 | \item{bootstrap.css}{Logical. When generating an \emph{html} document, 41 | include the \dQuote{\emph{includes/stylesheets/bootstrap.min.css"}} file 42 | content inside a \code{<style type="text/css">} tag in the document's 43 | \code{<head>}. \code{TRUE} by default. Can be set globally with 44 | \code{\link{st_options}}.} 45 | 46 | \item{custom.css}{Character. Path to a custom \emph{.css} file. Classes 47 | defined in this must also appear in the \code{table.classes} parameter 48 | in order to be applied to the table(s). Can be set globally with 49 | \code{\link{st_options}}. \code{NA} by default.} 50 | 51 | \item{silent}{Logical. Set to \code{TRUE} to hide console messages 52 | (\emph{e.g.}: ignored variables or \code{NaN} to \code{NA} 53 | transformations). \code{FALSE} by default.} 54 | 55 | \item{footnote}{Character. Text to display just after \emph{html} output 56 | tables. The default value (\dQuote{\emph{default}}) produces a two-line 57 | footnote indicating the package's name and version, the R version, and 58 | the current date. Has no effect on \emph{ascii} or \emph{markdown} 59 | content. Can contain standard \emph{html} tags. Set to \code{NA} to omit. 60 | Can be set globally with \code{\link{st_options}}.} 61 | 62 | \item{collapse}{Numeric. \code{0} by default. Set to \code{1} to make 63 | \code{freq()} sections collapsible (when clicking on the variable name). 64 | Future versions might provide alternate collapsing options.} 65 | 66 | \item{escape.pipe}{Logical. Set to \code{TRUE} when \code{style="grid"} 67 | and \code{file} argument is supplied if the intent is to generate a text 68 | file that can be converted to other formats using \emph{Pandoc}. Can be 69 | set globally with \code{\link{st_options}}.} 70 | 71 | \item{...}{Additional arguments used to override attributes stored in the 72 | object, or to change formatting via \code{\link[base]{format}} or 73 | \code{\link[pander]{pander}}. See \emph{Details}.} 74 | } 75 | \description{ 76 | Displays a list comprised of summarytools objects created with 77 | \code{\link{lapply}}. 78 | } 79 | \details{ 80 | This function is there only for cases where the object to be printed 81 | was created with \code{\link{lapply}}, as opposed to the recommended 82 | functions for creating grouped results (\code{\link{stby}} and 83 | \code{\link[dplyr]{group_by}}). 84 | } 85 | -------------------------------------------------------------------------------- /man/print.stby.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print.stby.R 3 | \name{print.stby} 4 | \alias{print.stby} 5 | \title{Print Method for Objects of Class \dQuote{stby}} 6 | \usage{ 7 | \method{print}{stby}(x, method = "pander", file = "", 8 | append = FALSE, report.title = NA, table.classes = NA, 9 | bootstrap.css = st_options('bootstrap.css'), 10 | custom.css = st_options('custom.css'), silent = FALSE, 11 | footnote = st_options('footnote'), 12 | escape.pipe = st_options('escape.pipe'), \dots) 13 | } 14 | \arguments{ 15 | \item{x}{A \emph{summarytools} object, created by one of the four core 16 | functions (\code{\link{freq}}, \code{\link{descr}}, \code{\link{ctable}}, 17 | or \code{\link{dfSummary}}).} 18 | 19 | \item{method}{Character. One of \dQuote{pander}, \dQuote{viewer}, 20 | \dQuote{browser}, or \dQuote{render}. Default value for the \code{print()} 21 | method is \dQuote{pander}; for \code{view()}/\code{stview()}, default is 22 | \dQuote{viewer} if session is running in \emph{RStudio}, \dQuote{browser} 23 | otherwise. The main use for \dQuote{render} is in \emph{R Markdown} 24 | documents.} 25 | 26 | \item{file}{Character. File name to write output to. Defaults to \dQuote{}.} 27 | 28 | \item{append}{Logical. Append output to existing file (specified using the 29 | \emph{file} argument). \code{FALSE} by default.} 30 | 31 | \item{report.title}{Character. For \emph{html} reports, this goes into the 32 | \code{<title>} tag. When left to \code{NA} (default), the first line of the 33 | heading section is used (\emph{e.g.}: \dQuote{Data Frame Summary}).} 34 | 35 | \item{table.classes}{Character. Additional \emph{html} classes to assign to 36 | output tables. \emph{Bootstrap css} classes can be used. User-defined 37 | classes (see the \emph{custom.css} argument) are also specified here. See 38 | \emph{details} section. \code{NA} by default.} 39 | 40 | \item{bootstrap.css}{Logical. When generating an \emph{html} document, 41 | include the \dQuote{\emph{includes/stylesheets/bootstrap.min.css"}} file 42 | content inside a \code{<style type="text/css">} tag in the document's 43 | \code{<head>}. \code{TRUE} by default. Can be set globally with 44 | \code{\link{st_options}}.} 45 | 46 | \item{custom.css}{Character. Path to a custom \emph{.css} file. Classes 47 | defined in this must also appear in the \code{table.classes} parameter 48 | in order to be applied to the table(s). Can be set globally with 49 | \code{\link{st_options}}. \code{NA} by default.} 50 | 51 | \item{silent}{Logical. Set to \code{TRUE} to hide console messages 52 | (\emph{e.g.}: ignored variables or \code{NaN} to \code{NA} 53 | transformations). \code{FALSE} by default.} 54 | 55 | \item{footnote}{Character. Text to display just after \emph{html} output 56 | tables. The default value (\dQuote{\emph{default}}) produces a two-line 57 | footnote indicating the package's name and version, the R version, and 58 | the current date. Has no effect on \emph{ascii} or \emph{markdown} 59 | content. Can contain standard \emph{html} tags. Set to \code{NA} to omit. 60 | Can be set globally with \code{\link{st_options}}.} 61 | 62 | \item{escape.pipe}{Logical. Set to \code{TRUE} when \code{style="grid"} 63 | and \code{file} argument is supplied if the intent is to generate a text 64 | file that can be converted to other formats using \emph{Pandoc}. Can be 65 | set globally with \code{\link{st_options}}.} 66 | 67 | \item{...}{Additional arguments used to override attributes stored in the 68 | object, or to change formatting via \code{\link[base]{format}} or 69 | \code{\link[pander]{pander}}. See \emph{Details}.} 70 | } 71 | \description{ 72 | Displays a list comprised of summarytools objects created with \code{stby}. 73 | } 74 | -------------------------------------------------------------------------------- /man/print.summarytools.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print.summarytools.R 3 | \name{print.summarytools} 4 | \alias{print.summarytools} 5 | \title{print.summarytools} 6 | \usage{ 7 | \method{print}{summarytools}(x, method = "pander", file = "", 8 | append = FALSE, report.title = NA, table.classes = NA, 9 | bootstrap.css = st_options('bootstrap.css'), 10 | custom.css = st_options('custom.css'), silent = FALSE, 11 | footnote = st_options('footnote'), max.tbl.height = Inf, 12 | collapse = 0, escape.pipe = st_options("escape.pipe"), \dots) 13 | } 14 | \arguments{ 15 | \item{x}{A \emph{summarytools} object, created by one of the four core 16 | functions (\code{\link{freq}}, \code{\link{descr}}, \code{\link{ctable}}, 17 | or \code{\link{dfSummary}}).} 18 | 19 | \item{method}{Character. One of \dQuote{pander}, \dQuote{viewer}, 20 | \dQuote{browser}, or \dQuote{render}. Default value for the \code{print()} 21 | method is \dQuote{pander}; for \code{view()}/\code{stview()}, default is 22 | \dQuote{viewer} if session is running in \emph{RStudio}, \dQuote{browser} 23 | otherwise. The main use for \dQuote{render} is in \emph{R Markdown} 24 | documents.} 25 | 26 | \item{file}{Character. File name to write output to. Defaults to \dQuote{}.} 27 | 28 | \item{append}{Logical. Append output to existing file (specified using the 29 | \emph{file} argument). \code{FALSE} by default.} 30 | 31 | \item{report.title}{Character. For \emph{html} reports, this goes into the 32 | \code{<title>} tag. When left to \code{NA} (default), the first line of the 33 | heading section is used (\emph{e.g.}: \dQuote{Data Frame Summary}).} 34 | 35 | \item{table.classes}{Character. Additional \emph{html} classes to assign to 36 | output tables. \emph{Bootstrap css} classes can be used. User-defined 37 | classes (see the \emph{custom.css} argument) are also specified here. See 38 | \emph{details} section. \code{NA} by default.} 39 | 40 | \item{bootstrap.css}{Logical. When generating an \emph{html} document, 41 | include the \dQuote{\emph{includes/stylesheets/bootstrap.min.css"}} file 42 | content inside a \code{<style type="text/css">} tag in the document's 43 | \code{<head>}. \code{TRUE} by default. Can be set globally with 44 | \code{\link{st_options}}.} 45 | 46 | \item{custom.css}{Character. Path to a custom \emph{.css} file. Classes 47 | defined in this must also appear in the \code{table.classes} parameter 48 | in order to be applied to the table(s). Can be set globally with 49 | \code{\link{st_options}}. \code{NA} by default.} 50 | 51 | \item{silent}{Logical. Set to \code{TRUE} to hide console messages 52 | (\emph{e.g.}: ignored variables or \code{NaN} to \code{NA} 53 | transformations). \code{FALSE} by default.} 54 | 55 | \item{footnote}{Character. Text to display just after \emph{html} output 56 | tables. The default value (\dQuote{\emph{default}}) produces a two-line 57 | footnote indicating the package's name and version, the R version, and 58 | the current date. Has no effect on \emph{ascii} or \emph{markdown} 59 | content. Can contain standard \emph{html} tags. Set to \code{NA} to omit. 60 | Can be set globally with \code{\link{st_options}}.} 61 | 62 | \item{max.tbl.height}{Numeric. Maximum table height \emph{in pixels} allowed 63 | in rendered \code{dfSummary()} tables. When this argument is used, results 64 | will show up in a \code{<div>} with the specified height and a scroll bar. 65 | Intended to be used in \emph{Rmd} documents with \code{method = "render"}. 66 | \code{Inf} by default.} 67 | 68 | \item{collapse}{Numeric. \code{0} by default. Set to \code{1} to make 69 | \code{freq()} sections collapsible (when clicking on the variable name). 70 | Future versions might provide alternate collapsing options.} 71 | 72 | \item{escape.pipe}{Logical. Set to \code{TRUE} when \code{style="grid"} 73 | and \code{file} argument is supplied if the intent is to generate a text 74 | file that can be converted to other formats using \emph{Pandoc}. Can be 75 | set globally with \code{\link{st_options}}.} 76 | 77 | \item{\dots}{Additional arguments used to override attributes stored in the 78 | object, or to change formatting via \code{\link[base]{format}} or 79 | \code{\link[pander]{pander}}. See \emph{Details}.} 80 | } 81 | \value{ 82 | \code{NULL} when \code{method="pander"}; A file path returned 83 | invisibly when \code{method="viewer"} or \code{"browser"}. In the 84 | latter case, the file path is also passed to \code{shell.exec} 85 | (\emph{Windows}) or \code{\link{system}} (\emph{*nix}), causing 86 | the document to be opened in default Web browser. 87 | } 88 | \description{ 89 | Display \code{summarytools} objects in the console, in Web Browser or in 90 | \emph{RStudio}'s Viewer, or write content to file. 91 | } 92 | \details{ 93 | \code{Ascii} and \emph{markdown} tables are generated using 94 | \code{\link[pander]{pander}}. 95 | 96 | The following arguments can be used to override formatting attributes stored 97 | in the object: 98 | \itemize{ 99 | \item \code{style} 100 | \item \code{round.digits} (except for \emph{dfSummary} objects) 101 | \item \code{plain.ascii} 102 | \item \code{justify} 103 | \item \code{split.tables} 104 | \item \code{headings} 105 | \item \code{display.labels} 106 | \item \code{varnumbers} (\code{\link{dfSummary}} objects only) 107 | \item \code{labels.col} (\code{\link{dfSummary}} objects only) 108 | \item \code{graph.col} (\code{\link{dfSummary}} objects only) 109 | \item \code{valid.col} (\code{\link{dfSummary}} objects only) 110 | \item \code{na.col} (\code{\link{dfSummary}} objects only) 111 | \item \code{col.widths} (\code{\link{dfSummary}} objects only) 112 | \item \code{keep.grp.vars} (\code{\link{dfSummary}} objects only) 113 | \item \code{report.nas} (\code{\link{freq}} objects only) 114 | \item \code{display.type} (\code{\link{freq}} objects only) 115 | \item \code{missing} (\code{\link{freq}} objects only) 116 | \item \code{totals} (\code{\link{freq}} and \code{\link{ctable}} objects) 117 | \item \code{caption} (\code{\link{freq}} and \code{\link{ctable}} objects) 118 | } 119 | 120 | The following arguments can be used to override heading elements: 121 | 122 | \itemize{ 123 | \item \code{Data.frame} 124 | \item \code{Data.frame.label} 125 | \item \code{Variable} 126 | \item \code{Variable.label} 127 | \item \code{Group} 128 | \item \code{date} 129 | \item \code{Weights} (\code{\link{freq}} & \code{\link{descr}} objects) 130 | \item \code{Data.type} (\code{\link{freq}} objects only) 131 | \item \code{Row.variable} (\code{\link{ctable}} objects only) 132 | \item \code{Col.variable} (\code{\link{ctable}} objects only) 133 | } 134 | } 135 | \examples{ 136 | \dontrun{ 137 | data(tobacco) 138 | view(dfSummary(tobacco), footnote = NA) 139 | } 140 | data(exams) 141 | print(freq(exams$gender), style = 'rmarkdown') 142 | print(descr(exams), headings = FALSE) 143 | 144 | } 145 | \references{ 146 | \href{https://github.com/dcomtois/summarytools/}{Summarytools on GitHub} 147 | \href{http://rapporter.github.io/pander/#general-options/}{List of pander options} 148 | \href{https://getbootstrap.com/docs/4.3/getting-started/introduction/}{Bootstrap Cascading Stylesheets} 149 | } 150 | \seealso{ 151 | \code{\link[pander]{pander}} 152 | } 153 | \author{ 154 | Dominic Comtois, \email{dominic.comtois@gmail.com} 155 | } 156 | \keyword{methods} 157 | \keyword{print} 158 | -------------------------------------------------------------------------------- /man/st_css.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/st_css.R 3 | \name{st_css} 4 | \alias{st_css} 5 | \title{Include \strong{summarytools}' \emph{css} Into Active Document} 6 | \usage{ 7 | st_css(main = TRUE, global = FALSE, bootstrap = FALSE, style.tag = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{main}{Logical. Include \emph{summarytools.css} file. \code{TRUE} by 11 | default. This will affects only \strong{summarytools} objects, for one 12 | exception: two properties of the \code{img} tag are redefined to have 13 | \code{background-color: transparent} and \code{border: 0}.} 14 | 15 | \item{global}{Logical. Include the additional \emph{summarytools-global.css} 16 | file, which affects all content in the document. Provides control over 17 | objects that were not \emph{html-rendered}; in particular, table widths 18 | and vertical alignment are modified to improve layout. \code{FALSE} by 19 | default.} 20 | 21 | \item{bootstrap}{Logical. Include \emph{bootstrap.min.css}. \code{FALSE} 22 | by default.} 23 | 24 | \item{style.tag}{Logical. Include the opening and closing \code{<style>} 25 | tags. \code{TRUE} by default.} 26 | 27 | \item{\dots}{Character. Path to additional \emph{css} file(s) to include.} 28 | } 29 | \value{ 30 | The \emph{css} file(s) content silently as a character vector, and 31 | prints (using \code{cat()}) the content. 32 | } 33 | \description{ 34 | Generate the \emph{css} needed by \strong{summarytools} in \emph{html} 35 | documents. 36 | } 37 | \details{ 38 | Typically the function is called right after the initial setup chunk 39 | of an \emph{R markdown} document, in a chunk having options 40 | \code{echo=FALSE} and \code{results="asis"}. 41 | } 42 | \author{ 43 | Dominic Comtois, \email{dominic.comtois@gmail.com} 44 | } 45 | \keyword{utilities} 46 | -------------------------------------------------------------------------------- /man/stby.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/stby.R 3 | \name{stby} 4 | \alias{stby} 5 | \title{Obtain Grouped Statistics With summarytools} 6 | \usage{ 7 | stby(data, INDICES, FUN, ..., useNA = FALSE) 8 | } 9 | \arguments{ 10 | \item{data}{an R object, normally a data frame, possibly a matrix.} 11 | 12 | \item{INDICES}{a grouping variable or a list of grouping variables, 13 | each of length \code{nrow(data)}.} 14 | 15 | \item{FUN}{a function to be applied to (usually data-frame) subsets of data.} 16 | 17 | \item{\dots}{Further arguments to FUN.} 18 | 19 | \item{useNA}{Make NA a valid grouping value in INDICES variable(s). 20 | Set to \code{FALSE} explicitly to eliminate message.} 21 | } 22 | \value{ 23 | An object of classes \dQuote{list} and \dQuote{summarytools}, 24 | giving results for each subset. 25 | } 26 | \description{ 27 | An adaptation base R's \code{\link{by}} function, designed to 28 | optimize the results' display. 29 | } 30 | \details{ 31 | When the grouping variable(s) contain NA values, the 32 | \code{base::\link[base]{by}} function (as well as summarytools 33 | versions prior to 1.1.0) ignores corresponding groups. Version 1.1.0 34 | allows setting \code{useNA = TRUE} to make new groups using 35 | NA values on the grouping variable(s), just as 36 | \code{dplyr::\link[dplyr]{group_by}} does. 37 | 38 | When NA values are detected and \code{useNA = FALSE}, a message is 39 | displayed; to disable this message, set \code{check.nas = FALSE}. 40 | } 41 | \examples{ 42 | data("tobacco") 43 | with(tobacco, stby(data = BMI, INDICES = gender, FUN = descr, 44 | check.nas = FALSE)) 45 | with(tobacco, stby(data = smoker, INDICES = gender, freq, useNA = TRUE)) 46 | with(tobacco, stby(data = list(x = smoker, y = diseased), 47 | INDICES = gender, FUN = ctable, useNA = TRUE)) 48 | 49 | } 50 | \seealso{ 51 | \code{\link[base]{by}}, \code{\link[dplyr]{group_by}} 52 | } 53 | \keyword{utilities} 54 | -------------------------------------------------------------------------------- /man/summarytools-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/summarytools.R 3 | \docType{package} 4 | \name{summarytools-package} 5 | \alias{summarytools} 6 | \alias{summarytools-package} 7 | \title{Tools to Quickly and Neatly Summarize Data} 8 | \description{ 9 | \pkg{summarytools} is a collection of functions which neatly and quickly 10 | summarize numerical and categorical data. Data frame summaries, frequency 11 | tables and cross-tabulations, as well as common descriptive (univariate) 12 | statistics can be produced in a straightforward manner. Users with little to 13 | no prior R programming experience but who are familiar with popular commercial 14 | statistical software such as SAS, SPSS and Stata will feel right at home. 15 | } 16 | \details{ 17 | These are the four core functions: 18 | \describe{ 19 | \item{dfSummary}{Extensive yet legible data frame summaries.} 20 | \item{freq}{Frequency tables supporting weights and displaying proportions 21 | of valid and of total data, including cumulative proportions.} 22 | \item{descr}{All common univariate descriptive stats applied to a single 23 | vector or to all numerical vectors contained in a data frame.} 24 | \item{ctable}{Cross-tabulations for pairs of categorical variables -- 25 | accepting both numerical and character vectors, as well as factors. 26 | Choose between \emph{Total}, \emph{Columns} or \emph{Rows} proportions, 27 | and optionally display chi-square statistic (with corresponding p-value), 28 | odds ratio, as well as risk ratio with flexible confidence intervals.} 29 | } 30 | 31 | \strong{Choice of output formats}: 32 | \describe{ 33 | \item{plain ascii}{Ideal when showing results in the R console.} 34 | \item{rmarkdown}{Perfect for writing short papers or presentations.} 35 | \item{html}{A format very well integrated in \emph{RStudio} -- but will 36 | work with any Web browser. Use the \code{\link{view}} function to display 37 | results directly in \emph{RStudio}'s viewer, or in your preferred Web 38 | browser.} 39 | } 40 | } 41 | \seealso{ 42 | Useful links: 43 | \itemize{ 44 | \item \url{https://github.com/dcomtois/summarytools} 45 | \item Report bugs at \url{https://github.com/dcomtois/summarytools/issues} 46 | } 47 | 48 | } 49 | \author{ 50 | \strong{Maintainer}: Dominic Comtois \email{dominic.comtois@gmail.com} 51 | 52 | } 53 | -------------------------------------------------------------------------------- /man/tabagisme.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tabagisme.R 3 | \docType{data} 4 | \name{tabagisme} 5 | \alias{tabagisme} 6 | \title{Usage du tabac et etat de sante (donnees simulees)} 7 | \format{ 8 | Un data frame de 1000 rangees et 9 colonnes 9 | } 10 | \usage{ 11 | data(tabagisme) 12 | } 13 | \description{ 14 | Jeu de donnees simulees de 1000 sujets, avec les 15 | colonnes suivantes: 16 | \itemize{ 17 | \item sexe Variable categorielle (facteur), 2 niveaux: 18 | \dQuote{F} et \dQuote{M}. Environ 500 chacun. 19 | \item age Numerique. 20 | \item age.gr Groupe d'age - variable categorielle, 4 niveaux. 21 | \item IMC Indice de masse corporelle (numerique). 22 | \item fumeur Variable categorielle, 2 niveaux 23 | (\dQuote{Oui} / \dQuote{Non}). 24 | \item cigs.par.jour Nombre de cigarettes fumees par jour 25 | (numerique). 26 | \item malade Variable categorielle, 2 niveaux 27 | (\dQuote{Oui} / \dQuote{Non}). 28 | \item maladie Champs texte. 29 | \item ponderation Poids echantillonal (numerique). 30 | } 31 | } 32 | \details{ 33 | Note sur la simulation des donnees: la probabilite pour 34 | un sujet de tomber dans la categorie \dQuote{malade} est 35 | basee sur une fonction arbitraire faisant intervenir l'age, 36 | l'IMC et le nombre de cigarettes fumees par jour. 37 | 38 | A copy of this dataset is \strong{available in English} under the name 39 | \dQuote{tobacco}. 40 | } 41 | \keyword{datasets} 42 | -------------------------------------------------------------------------------- /man/tb.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tb.R 3 | \name{tb} 4 | \alias{tb} 5 | \title{Convert Summarytools Objects into Tibbles} 6 | \usage{ 7 | tb( 8 | x, 9 | order = 1, 10 | drop.var.col = FALSE, 11 | recalculate = TRUE, 12 | fct.to.chr = FALSE, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{x}{a \code{freq()} or \code{descr()} output object.} 18 | 19 | \item{order}{Integer. Useful for grouped results produced with 20 | \code{\link{stby}} or \code{dplyr::group_by}. When set to \code{1} 21 | (default), the ordering is done using the grouping variables first. 22 | When set to \code{2}, the ordering is done according to the analytical 23 | (not grouping) variable. When set to \code{3}, the same ordering 24 | as with \code{2} is used, but the analytical variable is placed in 25 | first position. Depending on what function was used for grouping, 26 | the results will be different in subtle ways. See \emph{Details}.} 27 | 28 | \item{drop.var.col}{Logical. For \code{\link{descr}} objects, drop the 29 | \code{variable} column. This is possible only when statistics are 30 | produced for a single variable; when multiple variables are present, 31 | this parameter is ignored. \code{FALSE} by default.} 32 | 33 | \item{recalculate}{Logical. \strong{TRUE by default}. For grouped 34 | \code{\link{freq}} results, recalculate percentages to have total 35 | proportions sum up to 1. Defaults to \code{TRUE}.} 36 | 37 | \item{fct.to.chr}{Logical. When grouped objects 38 | are created with \code{dplyr::\link[dplyr]{group_by}}, the resulting 39 | tibble will have factor columns when the grouping variable itself is 40 | a factor. To convert them to character, set this to TRUE. See 41 | \emph{Details}.} 42 | 43 | \item{\dots}{For internal use only.} 44 | } 45 | \value{ 46 | A \code{\link[tibble]{tibble}} which is constructed following the 47 | \emph{tidy} principles. 48 | } 49 | \description{ 50 | Make a tidy dataset out of freq() or descr() outputs 51 | } 52 | \details{ 53 | \code{stby}, which is based on and \code{by}, initially make the first 54 | variable vary, keeping the other(s) constant. On the other hand, 55 | \code{group_by} initially keeps the first grouping variable(s) constant, 56 | making the last one vary. This will impact the ordering of the rows (and 57 | as a result, the cumulative percent columns, if present). 58 | 59 | Also, keep in mind that while \code{group_by} shows \code{NA} groups by 60 | default, \code{useNA = TRUE} must be used to achieve the same 61 | results with \code{stby}. 62 | } 63 | \examples{ 64 | 65 | tb(freq(iris$Species)) 66 | tb(descr(iris, stats = "common")) 67 | 68 | data("tobacco") 69 | tb(stby(tobacco, tobacco$gender, descr, stats = "fivenum",check.nas = FALSE), 70 | order=3) 71 | tb(stby(tobacco, tobacco$gender, descr, stats = "common", useNA = TRUE)) 72 | 73 | # Compare stby() and group_by() groups' ordering 74 | tb(with(tobacco, stby(diseased, list(gender, smoker), freq, useNA = TRUE))) 75 | 76 | \dontrun{ 77 | tobacco |> dplyr::group_by(gender, smoker) |> freq(diseased) |> tb() 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /man/tobacco.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tobacco.R 3 | \docType{data} 4 | \name{tobacco} 5 | \alias{tobacco} 6 | \title{Tobacco Use and Health - Simulated Dataset} 7 | \format{ 8 | A data frame with 1000 rows and 9 variables 9 | } 10 | \usage{ 11 | data(tobacco) 12 | } 13 | \description{ 14 | A simulated datasets of 1,000 subjects, with the following variables: 15 | } 16 | \details{ 17 | \itemize{ 18 | \item gender Factor with 2 levels: \dQuote{F} and \dQuote{M}, having 19 | roughly 500 of each. 20 | \item age Numerical. 21 | \item age.gr Factor with 4 age categories. 22 | \item BMI Body Mass Index (numerical). 23 | \item smoker Factor (\dQuote{Yes} / \dQuote{No}). 24 | \item cigs.per.day Number of cigarettes smoked per day 25 | (numerical). 26 | \item diseased Factor (\dQuote{Yes} / \dQuote{No}). 27 | \item disease Character. 28 | \item samp.wgts Sampling weights (numerical). 29 | } 30 | 31 | A note on simulation: probability for an individual to fall into 32 | category \dQuote{diseased} is based on an arbitrary function 33 | involving age, BMI and number of cigarettes per day. 34 | 35 | A copy of this dataset is also \strong{available in French} under 36 | the name \dQuote{tabagisme}. 37 | } 38 | \keyword{datasets} 39 | -------------------------------------------------------------------------------- /man/unlabel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/label.R 3 | \name{unlabel} 4 | \alias{unlabel} 5 | \title{Clear Variable and Data Frame Label(s)} 6 | \usage{ 7 | unlabel(x) 8 | } 9 | \arguments{ 10 | \item{x}{An R object to remove labels from.} 11 | } 12 | \description{ 13 | Returns the object with all labels removed. The \dQuote{label} attribute 14 | as well as the \dQuote{labelled} class (used by Hmisc and labelled) are 15 | cleared. 16 | } 17 | \seealso{ 18 | \code{\link{label}} 19 | } 20 | \author{ 21 | Dominic Comtois, \email{dominic.comtois@gmail.com}, 22 | } 23 | -------------------------------------------------------------------------------- /man/use_custom_lang.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/use_custom_lang.R 3 | \name{use_custom_lang} 4 | \alias{use_custom_lang} 5 | \title{Import and use a custom language} 6 | \usage{ 7 | use_custom_lang(file) 8 | } 9 | \arguments{ 10 | \item{file}{Character. The path to the translations file.} 11 | } 12 | \description{ 13 | If your language is not available or if you wish to customize the outputs' 14 | language to suit your preference, you can set up a translations file (see 15 | details) and import it with this function. 16 | } 17 | \details{ 18 | To build the translations file, copy the 19 | \emph{language_template.csv} file located in the installed 20 | package's \emph{includes} directory and fill out the \sQuote{custom} column 21 | using a text editor, leaving column titles unchanged. The file must also 22 | retain its \emph{UTF-8} encoding. 23 | } 24 | \keyword{utilities} 25 | -------------------------------------------------------------------------------- /man/view.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/view.R 3 | \name{view} 4 | \alias{view} 5 | \alias{stview} 6 | \title{view} 7 | \usage{ 8 | view(x, method = "viewer", file = "", append = FALSE, 9 | report.title = NA, table.classes = NA, 10 | bootstrap.css = st_options("bootstrap.css"), 11 | custom.css = st_options("custom.css"), silent = FALSE, 12 | footnote = st_options("footnote"), 13 | max.tbl.height = Inf, 14 | collapse = 0, 15 | escape.pipe = st_options("escape.pipe"), \dots) 16 | } 17 | \arguments{ 18 | \item{x}{A \emph{summarytools} object, created by one of the four core 19 | functions (\code{\link{freq}}, \code{\link{descr}}, \code{\link{ctable}}, 20 | or \code{\link{dfSummary}}).} 21 | 22 | \item{method}{Character. One of \dQuote{pander}, \dQuote{viewer}, 23 | \dQuote{browser}, or \dQuote{render}. Default value for the \code{print()} 24 | method is \dQuote{pander}; for \code{view()}/\code{stview()}, default is 25 | \dQuote{viewer} if session is running in \emph{RStudio}, \dQuote{browser} 26 | otherwise. The main use for \dQuote{render} is in \emph{R Markdown} 27 | documents.} 28 | 29 | \item{file}{Character. File name to write output to. Defaults to \dQuote{}.} 30 | 31 | \item{append}{Logical. Append output to existing file (specified using the 32 | \emph{file} argument). \code{FALSE} by default.} 33 | 34 | \item{report.title}{Character. For \emph{html} reports, this goes into the 35 | \code{<title>} tag. When left to \code{NA} (default), the first line of the 36 | heading section is used (\emph{e.g.}: \dQuote{Data Frame Summary}).} 37 | 38 | \item{table.classes}{Character. Additional \emph{html} classes to assign to 39 | output tables. \emph{Bootstrap css} classes can be used. User-defined 40 | classes (see the \emph{custom.css} argument) are also specified here. See 41 | \emph{details} section. \code{NA} by default.} 42 | 43 | \item{bootstrap.css}{Logical. When generating an \emph{html} document, 44 | include the \dQuote{\emph{includes/stylesheets/bootstrap.min.css"}} file 45 | content inside a \code{<style type="text/css">} tag in the document's 46 | \code{<head>}. \code{TRUE} by default. Can be set globally with 47 | \code{\link{st_options}}.} 48 | 49 | \item{custom.css}{Character. Path to a custom \emph{.css} file. Classes 50 | defined in this must also appear in the \code{table.classes} parameter 51 | in order to be applied to the table(s). Can be set globally with 52 | \code{\link{st_options}}. \code{NA} by default.} 53 | 54 | \item{silent}{Logical. Set to \code{TRUE} to hide console messages 55 | (\emph{e.g.}: ignored variables or \code{NaN} to \code{NA} 56 | transformations). \code{FALSE} by default.} 57 | 58 | \item{footnote}{Character. Text to display just after \emph{html} output 59 | tables. The default value (\dQuote{\emph{default}}) produces a two-line 60 | footnote indicating the package's name and version, the R version, and 61 | the current date. Has no effect on \emph{ascii} or \emph{markdown} 62 | content. Can contain standard \emph{html} tags. Set to \code{NA} to omit. 63 | Can be set globally with \code{\link{st_options}}.} 64 | 65 | \item{max.tbl.height}{Numeric. Maximum table height \emph{in pixels} allowed 66 | in rendered \code{dfSummary()} tables. When this argument is used, results 67 | will show up in a \code{<div>} with the specified height and a scroll bar. 68 | Intended to be used in \emph{Rmd} documents with \code{method = "render"}. 69 | \code{Inf} by default.} 70 | 71 | \item{collapse}{Numeric. \code{0} by default. Set to \code{1} to make 72 | \code{freq()} sections collapsible (when clicking on the variable name). 73 | Future versions might provide alternate collapsing options.} 74 | 75 | \item{escape.pipe}{Logical. Set to \code{TRUE} when \code{style="grid"} 76 | and \code{file} argument is supplied if the intent is to generate a text 77 | file that can be converted to other formats using \emph{Pandoc}. Can be 78 | set globally with \code{\link{st_options}}.} 79 | 80 | \item{...}{Additional arguments used to override attributes stored in the 81 | object, or to change formatting via \code{\link[base]{format}} or 82 | \code{\link[pander]{pander}}. See \emph{Details}.} 83 | } 84 | \description{ 85 | Visualize results in RStudio's Viewer or in Web Browser 86 | } 87 | \details{ 88 | Creates \emph{html} outputs and displays them in \emph{RStudio}'s viewer, in 89 | a browser, or renders the \emph{html} code in \emph{R markdown} documents. 90 | 91 | For objects of class \dQuote{\emph{summarytools}}, this function is simply 92 | a wrapper around \code{\link{print.summarytools}} with 93 | \code{method = "viewer"}. 94 | 95 | Objects of class \dQuote{\emph{by}}, \dQuote{\emph{stby}}, or 96 | \dQuote{\emph{list}} are dispatched to the present function, as it can 97 | manage multiple objects, whereas \code{\link{print.summarytools}} can only 98 | manage one object at a time. 99 | } 100 | -------------------------------------------------------------------------------- /man/what.is.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/what.is.R 3 | \name{what.is} 4 | \alias{what.is} 5 | \title{Obtain Extended Properties of Objects} 6 | \usage{ 7 | what.is(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{Any object.} 11 | 12 | \item{\dots}{Included for backward-compatibility only. Has no real use.} 13 | } 14 | \value{ 15 | A list with following elements: 16 | \describe{ 17 | \item{properties}{A data frame with the class(es), type, mode and storage 18 | mode of the object as well as the dim, length and object.size.} 19 | \item{attributes.lengths}{A named character vector giving all attributes 20 | (\emph{c.f.} \dQuote{names}, \dQuote{row.names}, \dQuote{class}, 21 | \dQuote{dim}, and so forth) along with their length.} 22 | \item{extensive.is}{A character vector of all the 23 | \emph{identifier functions.} (starting with \dQuote{is.}) that yield 24 | \code{TRUE} when used with \code{x} as argument.} 25 | \item{function.type}{When x is a function, results of 26 | \code{\link[pryr]{ftype}} are added.} 27 | } 28 | } 29 | \description{ 30 | Combination of most common \dQuote{macro-level} functions that describe an 31 | object. 32 | } 33 | \details{ 34 | An alternative to calling in turn \code{\link{class}}, \code{\link{typeof}}, 35 | \code{\link{dim}}, and so on. A call to this function will readily give all 36 | this information at once. 37 | } 38 | \examples{ 39 | what.is(1) 40 | what.is(NaN) 41 | what.is(iris3) 42 | what.is(print) 43 | what.is(what.is) 44 | 45 | } 46 | \seealso{ 47 | \code{\link{class}}, \code{\link{typeof}}, \code{\link{mode}}, 48 | \code{\link{storage.mode}}, \code{\link{dim}}, \code{\link{length}}, 49 | \code{\link{is.object}}, \code{\link[pryr]{otype}}, 50 | \code{\link{object.size}}, \code{\link[pryr]{ftype}} 51 | } 52 | \author{ 53 | Dominic Comtois, \email{dominic.comtois@gmail.com} 54 | } 55 | \keyword{attribute} 56 | \keyword{classes} 57 | \keyword{utilities} 58 | -------------------------------------------------------------------------------- /man/zap_attr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/helpers.R 3 | \name{zap_attr} 4 | \alias{zap_attr} 5 | \title{Remove Attributes to Get a Simplified Object} 6 | \usage{ 7 | zap_attr(x, except = c("dim", "dimnames")) 8 | } 9 | \arguments{ 10 | \item{x}{An object with attributes} 11 | 12 | \item{except}{Character. A vector of attribute names to preserve. By default, 13 | \dQuote{dim} and \dQuote{dimnames} are preserved.} 14 | } 15 | \description{ 16 | Get rid of summarytools-specific attributes to get a simple data structure 17 | (matrix, array, ...), which can be easily manipulated. 18 | } 19 | \details{ 20 | If the object contains grouped results: 21 | \itemize{ 22 | \item The inner objects will lose their attributes 23 | \item The \dQuote{stby} class will be replaced with \dQuote{by} 24 | \item The \dQuote{dim} and \dQuote{dimnames} attributes will be set to 25 | available relevant values, but expect slight differences between objects 26 | created with \code{stby()} \emph{vs} \code{group_by()}. 27 | } 28 | } 29 | \examples{ 30 | data(tobacco) 31 | zap_attr(descr(tobacco)) 32 | zap_attr(freq(tobacco$gender)) 33 | } 34 | -------------------------------------------------------------------------------- /translations/en.csv: -------------------------------------------------------------------------------- 1 | item ,context ,custom 2 | title.freq ,main heading ,Frequencies 3 | title.freq.weighted ,main heading ,Weighted Frequencies 4 | title.ctable ,main heading ,Cross-Tabulation 5 | title.ctable.weighted ,main heading ,Weighted Cross-Tabulation 6 | title.ctable.row ,main heading ,Row Proportions 7 | title.ctable.col ,main heading ,Column Proportions 8 | title.ctable.tot ,main heading ,Total Proportions 9 | title.descr ,main heading ,Descriptive Statistics 10 | title.descr.weighted ,main heading ,Weighted Descriptive Statistics 11 | title.dfSummary ,main heading ,Data Frame Summary 12 | n ,heading label ,N 13 | dimensions ,heading label (dfSummary) ,Dimensions 14 | duplicates ,heading label (dfSummary) ,Duplicates 15 | data.frame ,heading label (all functions) ,Data Frame 16 | label ,heading label (all functions) & column name (dfSummary) ,Label 17 | variable ,heading label (all functions) & column name (dfSummary) ,Variable 18 | group ,heading label (all functions when used with byst() / by() ,Group 19 | by ,heading label (descr when used with byst() / by() ,by 20 | weights ,heading label (descr & freq) ,Weights 21 | type ,heading label (freq) ,Type 22 | logical ,heading value for type (freq) ,Logical 23 | character ,heading value for type (freq) ,Character 24 | numeric ,heading value for type (freq) ,Numeric 25 | integer ,heading value for type (freq) ,Integer 26 | factor ,heading value for type (freq) ,Factor 27 | factor.ordered ,heading value for type (freq) ,Ordered Factor 28 | date ,heading value for type (freq) ,Date 29 | datetime ,heading value for type (freq) ,Datetime 30 | freq ,column name (freq) ,Freq 31 | pct ,column name (freq - when report.nas=FALSE) ,% 32 | pct.valid.f ,column name (freq) ,% Valid 33 | pct.valid.cum ,column name (freq) ,% Valid Cum. 34 | pct.total ,column name (freq) ,% Total 35 | pct.total.cum ,column name (freq) ,% Total Cum. 36 | pct.cum ,column name (freq) ,% Cum. 37 | valid ,column name (freq & dfSummary) & column content (dfSummary) ,Valid 38 | invalid ,column content (dfSummary for emails) ,Invalid 39 | total ,column grouping in html (freq) ,Total 40 | mean ,row name (descr) ,Mean 41 | sd.long ,row name (descr) ,Std.Dev 42 | sd ,cell content (dfSummary) ,sd 43 | min ,row name (descr) ,Min 44 | q1 ,row name (descr) - 1st quartile ,Q1 45 | med ,row name (descr) ,Median 46 | q3 ,row name (descr) - 3rd quartile ,Q3 47 | max ,row name (descr) ,Max 48 | mad ,row name (descr) - Median Absolute Deviation ,MAD 49 | iqr ,row name (descr) - Inter-Quartile Range ,IQR 50 | cv ,row name (descr) - Coefficient of Variation ,CV 51 | skewness ,row name (descr) ,Skewness 52 | se.skewness ,row name (descr) - Std. Error for Skewness ,SE.Skewness 53 | kurtosis ,row name (descr) ,Kurtosis 54 | n.valid ,row name (descr) - Count of non-missing values ,N.Valid 55 | pct.valid ,row name (descr) - % of non-missing values ,Pct.Valid 56 | no ,column name (dfSummary) - position of column in the d.f. ,No 57 | stats.values ,column name (dfSummary) ,Stats / Values 58 | freqs.pct.valid ,column name (dfSummary) ,Freqs (% of Valid) 59 | graph ,column name (dfSummary) ,Graph 60 | missing ,column name (dfSummary) ,Missing 61 | distinct.value ,cell content (dfSummary) - singular form ,distinct value 62 | distinct.values ,cell content (dfSummary) - plural form ,distinct values 63 | all.nas ,cell content (dfSummary) - column has only NA's ,All NA's 64 | empty.str ,cell content (freq) - column has values equal to "" ,Empty string 65 | all.empty.str ,cell content (dfSummary) - column has only empty str's ,All empty strings 66 | all.empty.str.nas ,cell content (dfSummary) - col. has only NA's and empty str's ,All empty strings / NA's 67 | no.levels.defined ,cell content (dfSummary) - factor has no levels defined ,No levels defined 68 | int.sequence ,cell content (dfSummary) ,Integer sequence 69 | rounded ,cell content (dfSummary) - note appearing in Stats/Values ,rounded 70 | other ,cell content (freq) - used w/ rows arg (filtered out values) ,(Other) 71 | others ,cell content (dfSummary) - nbr of values not displayed ,others 72 | codes ,cell content (dfSummary) - When UPC codes are detected ,codes 73 | mode ,cell content (dfSummary) - mode = most frequent value ,mode 74 | med.short ,cell content (dfSummary) - median (shortened) ,med 75 | start ,cell content (dfSummary) - earliest date for date-type cols. ,Start 76 | end ,cell content (dfSummary) - latest date for data-type cols. ,End 77 | emails ,cell content (dfSummary) ,Emails 78 | generated.by ,footnote content ,Generated by 79 | version ,footnote content ,version 80 | date.fmt ,footnote - date format (see ?strptime) ,%Y-%m-%d 81 | -------------------------------------------------------------------------------- /translations/es.csv: -------------------------------------------------------------------------------- 1 | item ,context ,es 2 | title.freq ,main heading ,Frecuencias 3 | title.freq.weighted ,main heading ,Frecuencías ponderadas 4 | title.ctable ,main heading ,Tabulación cruzada 5 | title.ctable.weighted ,main heading ,Tabulación cruzada ponderada 6 | title.ctable.row ,main heading ,proporciones por líneas 7 | title.ctable.col ,main heading ,proporciones por columnas 8 | title.ctable.tot ,main heading ,proporcíón del total 9 | title.descr ,main heading ,Estadísticas descriptivas 10 | title.descr.weighted ,main heading ,Estadísticas descriptivas ponderadas 11 | title.dfSummary ,main heading ,Tabla resumen 12 | n ,heading label ,N 13 | dimensions ,heading label (dfSummary) ,Dimensiones 14 | duplicates ,heading label (dfSummary) ,Duplicados 15 | data.frame ,heading label (all functions) ,Data frame 16 | label ,heading label (all functions) & column name (dfSummary) ,Etiqueta 17 | variable ,heading label (all functions) & column name (dfSummary) ,Variable 18 | group ,heading label (all functions when used with byst() / by() ,Subgrupo 19 | by ,heading label (descr when used with byst() / by() ,por 20 | weights ,heading label (descr & freq) ,Pesos 21 | type ,heading label (freq) ,Tipo 22 | logical ,heading value for type (freq) ,Booleana 23 | character ,heading value for type (freq) ,Alfahnumérico 24 | numeric ,heading value for type (freq) ,Numérico 25 | integer ,heading value for type (freq) ,Entero 26 | factor ,heading value for type (freq) ,Factor 27 | factor.ordered ,heading value for type (freq) ,Factor ordenado 28 | date ,heading value for type (freq) ,Fecha 29 | datetime ,heading value for type (freq) ,Fecha y hora 30 | freq ,column name (freq) ,Frec. 31 | pct ,column name (freq - when report.nas=FALSE) ,% 32 | pct.valid.f ,column name (freq) ,% Válido 33 | pct.valid.cum ,column name (freq) ,% Válido acu. 34 | pct.total ,column name (freq) ,% Total 35 | pct.total.cum ,column name (freq) ,% Total acu. 36 | pct.cum ,column name (freq) ,% Acu. 37 | valid ,column name (freq & dfSummary) & column content (dfSummary) ,Válido 38 | invalid ,column content (dfSummary for emails) ,Inválido 39 | total ,column grouping in html (freq) ,Total 40 | mean ,row name (descr) ,Media 41 | sd.long ,row name (descr) ,Dev.std. 42 | sd ,cell content (dfSummary) ,d-s 43 | min ,row name (descr) ,Min 44 | q1 ,row name (descr) - 1st quartile ,Q1 45 | med ,row name (descr) ,Mediana 46 | q3 ,row name (descr) - 3rd quartile ,Q3 47 | max ,row name (descr) ,Max 48 | mad ,row name (descr) - Median Absolute Deviation ,DAP 49 | iqr ,row name (descr) - Inter-Quartile Range ,RI 50 | cv ,row name (descr) - Coefficient of Variation ,CV 51 | skewness ,row name (descr) ,Asimetría 52 | se.skewness ,row name (descr) - Std. Error for Skewness ,ES-Asimetría 53 | kurtosis ,row name (descr) ,Curtosis 54 | n.valid ,row name (descr) - Count of non-missing values ,Num.Válido 55 | pct.valid ,row name (descr) - % of non-missing values ,Pct.Válido 56 | no ,column name (dfSummary) - position of column in the d.f. ,No 57 | stats.values ,column name (dfSummary) ,Estadísticas / Valores 58 | freqs.pct.valid ,column name (dfSummary) ,Frec. (% sobre válidos) 59 | graph ,column name (dfSummary) ,Gráfico 60 | missing ,column name (dfSummary) ,Perdidos 61 | distinct.value ,cell content (dfSummary) - singular form ,valor distinto 62 | distinct.values ,cell content (dfSummary) - plural form ,valores distintos 63 | all.nas ,cell content (dfSummary) - column has only NA's ,100% NA's 64 | empty.str ,cell content (freq) - column has values equal to "" ,Cadena vacía 65 | all.empty.str ,cell content (dfSummary) - column has only empty str's ,100% cadenas vacías 66 | all.empty.str.nas ,cell content (dfSummary) - col. has only NA's and empty str's ,100% NA's o cadenas vacías 67 | no.levels.defined ,cell content (dfSummary) - factor has no levels defined ,No niveles definidos 68 | int.sequence ,cell content (dfSummary) ,Secuencia de enteros 69 | rounded ,cell content (dfSummary) - note appearing in Stats/Values ,redondeo 70 | other ,cell content (freq) - used w/ rows arg (filtered out values) ,(Otro) 71 | others ,cell content (dfSummary) - nbr of values not displayed ,otros 72 | codes ,cell content (dfSummary) - When UPC codes are detected ,códigos 73 | mode ,cell content (dfSummary) - mode = most frequent value ,modo 74 | med.short ,cell content (dfSummary) - median (shortened) ,mediana 75 | start ,cell content (dfSummary) - earliest date for date-type cols. ,principio 76 | end ,cell content (dfSummary) - latest date for data-type cols. ,fin 77 | emails ,cell content (dfSummary) ,Correos 78 | generated.by ,footnote content ,Generado por 79 | version ,footnote content ,versión 80 | date.fmt ,footnote - date format (see ?strptime) ,%Y-%m-%d 81 | -------------------------------------------------------------------------------- /translations/language_template.csv: -------------------------------------------------------------------------------- 1 | item ,context ,custom 2 | title.freq ,main heading ,Frequencies 3 | title.freq.weighted ,main heading ,Weighted Frequencies 4 | title.ctable ,main heading ,Cross-Tabulation 5 | title.ctable.weighted ,main heading ,Weighted Cross-Tabulation 6 | title.ctable.row ,main heading ,Row Proportions 7 | title.ctable.col ,main heading ,Column Proportions 8 | title.ctable.tot ,main heading ,Total Proportions 9 | title.descr ,main heading ,Descriptive Statistics 10 | title.descr.weighted ,main heading ,Weighted Descriptive Statistics 11 | title.dfSummary ,main heading ,Data Frame Summary 12 | n ,heading label ,N 13 | dimensions ,heading label (dfSummary) ,Dimensions 14 | duplicates ,heading label (dfSummary) ,Duplicates 15 | data.frame ,heading label (all functions) ,Data Frame 16 | label ,heading label (all functions) & column name (dfSummary) ,Label 17 | variable ,heading label (all functions) & column name (dfSummary) ,Variable 18 | group ,heading label (all functions when used with byst() / by() ,Group 19 | by ,heading label (descr when used with byst() / by() ,by 20 | weights ,heading label (descr & freq) ,Weights 21 | type ,heading label (freq) ,Type 22 | logical ,heading value for type (freq) ,Logical 23 | character ,heading value for type (freq) ,Character 24 | numeric ,heading value for type (freq) ,Numeric 25 | integer ,heading value for type (freq) ,Integer 26 | factor ,heading value for type (freq) ,Factor 27 | factor.ordered ,heading value for type (freq) ,Ordered Factor 28 | date ,heading value for type (freq) ,Date 29 | datetime ,heading value for type (freq) ,Datetime 30 | freq ,column name (freq) ,Freq 31 | pct ,column name (freq - when report.nas=FALSE) ,% 32 | pct.valid.f ,column name (freq) ,% Valid 33 | pct.valid.cum ,column name (freq) ,% Valid Cum. 34 | pct.total ,column name (freq) ,% Total 35 | pct.total.cum ,column name (freq) ,% Total Cum. 36 | pct.cum ,column name (freq) ,% Cum. 37 | valid ,column name (freq & dfSummary) & column content (dfSummary) ,Valid 38 | invalid ,column content (dfSummary for emails) ,Invalid 39 | total ,column grouping in html (freq) ,Total 40 | mean ,row name (descr) ,Mean 41 | sd.long ,row name (descr) ,Std.Dev 42 | sd ,cell content (dfSummary) ,sd 43 | min ,row name (descr) ,Min 44 | q1 ,row name (descr) - 1st quartile ,Q1 45 | med ,row name (descr) ,Median 46 | q3 ,row name (descr) - 3rd quartile ,Q3 47 | max ,row name (descr) ,Max 48 | mad ,row name (descr) - Median Absolute Deviation ,MAD 49 | iqr ,row name (descr) - Inter-Quartile Range ,IQR 50 | cv ,row name (descr) - Coefficient of Variation ,CV 51 | skewness ,row name (descr) ,Skewness 52 | se.skewness ,row name (descr) - Std. Error for Skewness ,SE.Skewness 53 | kurtosis ,row name (descr) ,Kurtosis 54 | n.valid ,row name (descr) - Count of non-missing values ,N.Valid 55 | pct.valid ,row name (descr) - % of non-missing values ,Pct.Valid 56 | no ,column name (dfSummary) - position of column in the d.f. ,No 57 | stats.values ,column name (dfSummary) ,Stats / Values 58 | freqs.pct.valid ,column name (dfSummary) ,Freqs (% of Valid) 59 | graph ,column name (dfSummary) ,Graph 60 | missing ,column name (dfSummary) ,Missing 61 | distinct.value ,cell content (dfSummary) - singular form ,distinct value 62 | distinct.values ,cell content (dfSummary) - plural form ,distinct values 63 | all.nas ,cell content (dfSummary) - column has only NA's ,All NA's 64 | empty.str ,cell content (freq) - column has values equal to "" ,Empty string 65 | all.empty.str ,cell content (dfSummary) - column has only empty str's ,All empty strings 66 | all.empty.str.nas ,cell content (dfSummary) - col. has only NA's and empty str's ,All empty strings / NA's 67 | no.levels.defined ,cell content (dfSummary) - factor has no levels defined ,No levels defined 68 | int.sequence ,cell content (dfSummary) ,Integer sequence 69 | rounded ,cell content (dfSummary) - note appearing in Stats/Values ,rounded 70 | other ,cell content (freq) - used w/ rows arg (filtered out values) ,(Other) 71 | others ,cell content (dfSummary) - nbr of values not displayed ,others 72 | codes ,cell content (dfSummary) - When UPC codes are detected ,codes 73 | mode ,cell content (dfSummary) - mode = most frequent value ,mode 74 | med.short ,cell content (dfSummary) - median (shortened) ,med 75 | start ,cell content (dfSummary) - earliest date for date-type cols. ,Start 76 | end ,cell content (dfSummary) - latest date for data-type cols. ,End 77 | emails ,cell content (dfSummary) ,Emails 78 | generated.by ,footnote content ,Generated by 79 | version ,footnote content ,version 80 | date.fmt ,footnote - date format (see ?strptime) ,%Y-%m-%d 81 | -------------------------------------------------------------------------------- /translations/tr.csv: -------------------------------------------------------------------------------- 1 | item ,context ,tr 2 | title.freq ,main heading ,Sıklık 3 | title.freq.weighted ,main heading ,Ağırlıklandırılmış Sıklık 4 | title.ctable ,main heading ,Çapraz Tablo 5 | title.ctable.weighted,main heading ,Ağırlıklandırılmış Çapraz Tablo 6 | title.ctable.row ,main heading ,Satır Oranları 7 | title.ctable.col ,main heading ,Sütun Oranları 8 | title.ctable.tot ,main heading ,Toplam Oranlar 9 | title.descr ,main heading ,Tanımlayıcı İstatistikler 10 | title.descr.weighted ,main heading ,Ağırlıklandırılmış Tanımlayıcı İstatistikler 11 | title.dfSummary ,main heading ,Veri Çerçevesi Özeti 12 | n ,heading label ,N 13 | dimensions ,heading label (dfSummary) ,Boyutlar 14 | duplicates ,heading label (dfSummary) ,Tekrar Edenler 15 | data.frame ,heading label (all functions) ,Veri Çerçevesi 16 | label ,heading label (all functions) & column name (dfSummary) ,Etiket 17 | variable ,heading label (all functions) & column name (dfSummary) ,Değişken 18 | group ,heading label (all functions when used with byst() / by() ,Grup 19 | by ,heading label (descr when used with byst() / by() ,göre 20 | weights ,heading label (descr & freq) ,Ağırlıklar 21 | type ,heading label (freq) ,Tür 22 | logical ,heading value for type (freq) ,Mantıksal 23 | character ,heading value for type (freq) ,Karakter 24 | numeric ,heading value for type (freq) ,Sayısal 25 | integer ,heading value for type (freq) ,Tamsayı 26 | factor ,heading value for type (freq) ,Faktör 27 | factor.ordered ,heading value for type (freq) ,Sıralı Faktör 28 | date ,heading value for type (freq) ,Tarih 29 | datetime ,heading value for type (freq) ,Tarihzaman 30 | freq ,column name (freq) ,Sıklık 31 | pct ,column name (freq - when report.nas=FALSE) ,% 32 | pct.valid.f ,column name (freq) ,Geçerli % 33 | pct.valid.cum ,column name (freq) ,Küm. Geçerli % 34 | pct.total ,column name (freq) ,Toplam % 35 | pct.total.cum ,column name (freq) ,Küm. Toplam % 36 | pct.cum ,column name (freq) ,Küm. % 37 | valid ,column name (freq & dfSummary) & column content (dfSummary) ,Geçerli 38 | invalid ,column content (dfSummary for emails) ,Geçersiz 39 | total ,column grouping in html (freq) ,Toplam 40 | mean ,row name (descr) ,Ortalama 41 | sd.long ,row name (descr) ,Std.Sap 42 | sd ,cell content (dfSummary) ,ss 43 | min ,row name (descr) ,Min 44 | q1 ,row name (descr) - 1st quartile ,Q1 45 | med ,row name (descr) ,Medyan 46 | q3 ,row name (descr) - 3rd quartile ,Q3 47 | max ,row name (descr) ,Mak 48 | mad ,row name (descr) - Median Absolute Deviation ,OMS 49 | iqr ,row name (descr) - Inter-Quartile Range ,ÇA 50 | cv ,row name (descr) - Coefficient of Variation ,CV 51 | skewness ,row name (descr) ,Çarpıklık 52 | se.skewness ,row name (descr) - Std. Error for Skewness ,Çarpıklık.SH 53 | kurtosis ,row name (descr) ,Basıklık 54 | n.valid ,row name (descr) - Count of non-missing values ,Geçerli.N 55 | pct.valid ,row name (descr) - % of non-missing values ,Geçerli.Yzd 56 | no ,column name (dfSummary) - position of column in the d.f. ,No 57 | stats.values ,column name (dfSummary) ,İstat / Değerler 58 | freqs.pct.valid ,column name (dfSummary) ,Sıklık (Geçerli %) 59 | graph ,column name (dfSummary) ,Grafik 60 | missing ,column name (dfSummary) ,Eksik 61 | distinct.value ,cell content (dfSummary) - singular form ,Farklı değer 62 | distinct.values ,cell content (dfSummary) - plural form ,Farklı değerler 63 | all.nas ,cell content (dfSummary) - column has only NA's ,Tüm NA'lar 64 | empty.str ,cell content (freq) - column has values equal to "" ,Boş dize 65 | all.empty.str ,cell content (dfSummary) - column has only empty str's ,Tüm boş diziler 66 | all.empty.str.nas ,cell content (dfSummary) - col. has only NA's and empty str's ,Tüm boş diziler / NA'lar 67 | no.levels.defined ,cell content (dfSummary) - factor has no levels defined ,Tanımlanmış seviye yok 68 | int.sequence ,cell content (dfSummary) ,Tamsayı dizisi 69 | rounded ,cell content (dfSummary) - note appearing in Stats/Values ,yuvarlanmış 70 | other ,cell content (freq) - used w/ rows arg (filtered out values) ,(Diğer) 71 | others ,cell content (dfSummary) - nbr of values not displayed ,diğerleri 72 | codes ,cell content (dfSummary) - When UPC codes are detected ,kodlar 73 | mode ,cell content (dfSummary) - mode = most frequent value ,mod 74 | med.short ,cell content (dfSummary) - median (shortened) ,med 75 | start ,cell content (dfSummary) - earliest date for date-type cols. ,Başlangıç 76 | end ,cell content (dfSummary) - latest date for data-type cols. ,Bitiş 77 | emails ,cell content (dfSummary) ,e-postalar 78 | generated.by ,footnote content ,Generated by 79 | version ,footnote content ,versiyon 80 | date.fmt ,footnote - date format (see ?strptime) ,%Y-%m-%d 81 | -------------------------------------------------------------------------------- /translations/update_translations.R: -------------------------------------------------------------------------------- 1 | # Update package translations 2 | # Import english file first - the others will be merged to it. 3 | setwd("~/GitHub/summarytools") 4 | tr <- read.csv("translations/en.csv", strip.white = TRUE, 5 | stringsAsFactors = FALSE, encoding = "UTF-8") 6 | items <- tr$item 7 | tr <- t(as.matrix(tr[,-1:-2])) 8 | colnames(tr) <- items 9 | tr <- as.data.frame(tr, stringsAsFactors = FALSE) 10 | rownames(tr) <- "en" 11 | .translations <- tr 12 | 13 | for (f in list.files("translations")) { 14 | if (f == "en.csv" || !grepl("^\\w{2}\\.csv$", f)) { 15 | next 16 | } 17 | tr <- read.csv(paste("translations", f, sep = "/"), strip.white = TRUE, 18 | stringsAsFactors = FALSE, encoding = "UTF-8") 19 | items <- tr$item 20 | tr <- t(as.matrix(tr[,-1:-2])) 21 | colnames(tr) <- items 22 | tr <- as.data.frame(tr, stringsAsFactors = FALSE) 23 | rownames(tr) <- substr(f, 1, 2) 24 | .translations[nrow(.translations) + 1, ] <- tr 25 | } 26 | 27 | 28 | .keywords_context <- read.csv("translations/language_template.csv", 29 | encoding = "UTF-8", strip.white = TRUE, 30 | stringsAsFactors = FALSE)[,-3] 31 | rownames(.keywords_context) <- .keywords_context$item 32 | .keywords_context$item <- NULL 33 | 34 | usethis::use_data(.translations, .keywords_context, 35 | internal = TRUE, overwrite = TRUE) 36 | 37 | rm(tr, f, items) 38 | 39 | # Check that translations is in the package's environment (after build) 40 | # ls(loadNamespace("summarytools")) 41 | # View(summarytools:::.translations) 42 | -------------------------------------------------------------------------------- /vignettes/assets/define_keywords.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/vignettes/assets/define_keywords.png -------------------------------------------------------------------------------- /vignettes/assets/dfSummary_in_RStudio_Viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/vignettes/assets/dfSummary_in_RStudio_Viewer.png -------------------------------------------------------------------------------- /vignettes/assets/dfSummary_md.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dcomtois/summarytools/99f53a2b7cafbd3af5f6e9630a50ad7bb0c5d2c3/vignettes/assets/dfSummary_md.png -------------------------------------------------------------------------------- /vignettes/assets/exclamation-diamond.svg: -------------------------------------------------------------------------------- 1 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-diamond" viewBox="0 0 16 16"> 2 | <path d="M6.95.435c.58-.58 1.52-.58 2.1 0l6.515 6.516c.58.58.58 1.519 0 2.098L9.05 15.565c-.58.58-1.519.58-2.098 0L.435 9.05a1.482 1.482 0 0 1 0-2.098L6.95.435zm1.4.7a.495.495 0 0 0-.7 0L1.134 7.65a.495.495 0 0 0 0 .7l6.516 6.516a.495.495 0 0 0 .7 0l6.516-6.516a.495.495 0 0 0 0-.7L8.35 1.134z"/> 3 | <path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/> 4 | </svg> -------------------------------------------------------------------------------- /vignettes/assets/lightbulb.svg: -------------------------------------------------------------------------------- 1 | <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lightbulb" viewBox="0 0 16 16"> 2 | <path d="M2 6a6 6 0 1 1 10.174 4.31c-.203.196-.359.4-.453.619l-.762 1.769A.5.5 0 0 1 10.5 13a.5.5 0 0 1 0 1 .5.5 0 0 1 0 1l-.224.447a1 1 0 0 1-.894.553H6.618a1 1 0 0 1-.894-.553L5.5 15a.5.5 0 0 1 0-1 .5.5 0 0 1 0-1 .5.5 0 0 1-.46-.302l-.761-1.77a1.964 1.964 0 0 0-.453-.618A5.984 5.984 0 0 1 2 6zm6-5a5 5 0 0 0-3.479 8.592c.263.254.514.564.676.941L5.83 12h4.342l.632-1.467c.162-.377.413-.687.676-.941A5 5 0 0 0 8 1z"/> 3 | </svg> -------------------------------------------------------------------------------- /vignettes/assets/vignette.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | margin: 1em auto; 4 | max-width: 700px; 5 | overflow: visible; 6 | padding-left: 2em; 7 | padding-right: 2em; 8 | font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; 9 | font-size: 14px; 10 | line-height: 1.45; 11 | } 12 | 13 | /* Start Edit DC */ 14 | .infobox { 15 | padding: .8em; 16 | margin: 10px; 17 | border: 1px solid SteelBlue; 18 | border-radius: 5px; 19 | background: #f5f5f5 5px center/3em no-repeat; 20 | } 21 | /* End Edit DC */ 22 | 23 | #TOC { 24 | clear: both; 25 | margin: 0 0 10px 10px; 26 | padding: 4px; 27 | width: 75%; 28 | border: 1px solid #CCCCCC; 29 | border-radius: 5px; 30 | 31 | background-color: #f6f6f6; 32 | font-size: 13px; 33 | line-height: 1.7; 34 | } 35 | 36 | #TOC .toctitle { 37 | font-weight: bold; 38 | font-size: 15px; 39 | margin-left: 5px; 40 | } 41 | 42 | #TOC ul { 43 | padding-left: 40px; 44 | margin-left: -1.5em; 45 | margin-top: 5px; 46 | margin-bottom: 5px; 47 | } 48 | #TOC ul ul { 49 | margin-left: -2em; 50 | } 51 | #TOC li { 52 | line-height: 20px; 53 | } 54 | 55 | table { 56 | margin: 1em auto; 57 | border-width: 1px; 58 | border-color: #DDDDDD; 59 | border-style: outset; 60 | border-collapse: collapse; 61 | } 62 | table th { 63 | border-width: 2px; 64 | padding: 5px; 65 | border-style: inset; 66 | } 67 | table td { 68 | border-width: 1px; 69 | border-style: inset; 70 | line-height: 18px; 71 | padding: 5px 5px; 72 | } 73 | table, table th, table td { 74 | border-left-style: none; 75 | border-right-style: none; 76 | } 77 | table thead, table tr.even { 78 | background-color: #f7f7f7; 79 | } 80 | 81 | p { 82 | margin: 0.8em 0 0.6em 0; /* Edited DC */ 83 | } 84 | 85 | blockquote { 86 | background-color: #f6f6f6; 87 | padding: 0.25em 0.75em; 88 | } 89 | 90 | hr { 91 | border-style: solid; 92 | border: none; 93 | border-top: 1px solid #777; 94 | margin: 28px 0; 95 | } 96 | 97 | dl { 98 | margin-left: 0; 99 | } 100 | dl dd { 101 | margin-bottom: 13px; 102 | margin-left: 13px; 103 | } 104 | dl dt { 105 | font-weight: bold; 106 | } 107 | 108 | ul { 109 | margin-top: 0; 110 | } 111 | ul li { 112 | list-style: circle outside; 113 | } 114 | ul ul { 115 | margin-bottom: 0; 116 | } 117 | 118 | pre, code { 119 | background-color: #f7f7f7; 120 | border-radius: 3px; 121 | color: #333; 122 | white-space: pre-wrap; /* Wrap long lines */ 123 | } 124 | pre { 125 | border-radius: 3px; 126 | margin: 5px 0px 10px 0px; 127 | padding: 10px; 128 | } 129 | pre:not([class]) { 130 | background-color: #f7f7f7; 131 | } 132 | 133 | code { 134 | font-family: Consolas, Monaco, 'Courier New', monospace; 135 | font-size: 85%; 136 | } 137 | p > code, li > code { 138 | padding: 2px 0px; 139 | } 140 | 141 | div.figure { 142 | text-align: center; 143 | } 144 | img { 145 | background-color: #FFFFFF; 146 | padding: 2px; 147 | border: 1px solid #DDDDDD; 148 | border-radius: 3px; 149 | border: 1px solid #CCCCCC; 150 | margin: 0 5px; 151 | } 152 | 153 | h1 { 154 | margin-top: 0; 155 | font-size: 35px; 156 | line-height: 40px; 157 | } 158 | 159 | h2 { 160 | border-bottom: 4px solid #f7f7f7; 161 | padding-top: 10px; 162 | padding-bottom: 2px; 163 | font-size: 145%; 164 | } 165 | 166 | h3 { 167 | border-bottom: 2px solid #f7f7f7; 168 | padding-top: 10px; 169 | font-size: 120%; 170 | } 171 | 172 | h4 { 173 | border-bottom: 1px solid #f7f7f7; 174 | margin-left: 8px; 175 | font-size: 105%; 176 | } 177 | 178 | h5, h6 { 179 | border-bottom: 1px solid #ccc; 180 | font-size: 105%; 181 | } 182 | 183 | a { 184 | color: #0033dd; 185 | text-decoration: none; 186 | } 187 | a:hover { 188 | color: #6666ff; } 189 | a:visited { 190 | color: #800080; } 191 | a:visited:hover { 192 | color: #BB00BB; } 193 | a[href^="http:"] { 194 | text-decoration: underline; } 195 | a[href^="https:"] { 196 | text-decoration: underline; } 197 | 198 | /* Class described in https://benjeffrey.com/posts/pandoc-syntax-highlighting-css 199 | Colours from https://gist.github.com/robsimmons/1172277 */ 200 | 201 | code > span.kw { color: #555; font-weight: bold; } /* Keyword */ 202 | code > span.dt { color: #902000; } /* DataType */ 203 | code > span.dv { color: #40a070; } /* DecVal (decimal values) */ 204 | code > span.bn { color: #d14; } /* BaseN */ 205 | code > span.fl { color: #d14; } /* Float */ 206 | code > span.ch { color: #d14; } /* Char */ 207 | code > span.st { color: #d14; } /* String */ 208 | code > span.co { color: #888888; font-style: italic; } /* Comment */ 209 | code > span.ot { color: #007020; } /* OtherToken */ 210 | code > span.al { color: #ff0000; font-weight: bold; } /* AlertToken */ 211 | code > span.fu { color: #900; font-weight: bold; } /* Function calls */ 212 | code > span.er { color: #a61717; background-color: #e3d2d2; } /* ErrorTok */ 213 | 214 | --------------------------------------------------------------------------------