MyNixOS website logo
Description

Make Quick Descriptive Tables for Continuous Variables.

Quickly make tables of descriptive statistics (i.e., counts, means, confidence intervals) for continuous variables. This package is designed to work in a Tidyverse pipeline, and consideration has been given to get results from R to 'Microsoft Word' ® with minimal pain.

meantables meantables hex logo

CRANstatus

The goal of meantables is to quickly make tables of descriptive statistics (i.e., counts, means, confidence intervals) for continuous variables. This package is designed to work in a Tidyverse pipeline, and consideration has been given to get results from R to ‘Microsoft Word’ ® with minimal pain.

Installation

You can install the released version of meantables from CRAN with:

install.packages("meantables")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("brad-cannell/meantables")

Example

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(meantables)
data("mtcars")

Overall mean table with defaults

mtcars %>% 
  mean_table(mpg)
#> # A tibble: 1 × 9
#>   response_var     n  mean    sd   sem   lcl   ucl   min   max
#>   <chr>        <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 mpg             32  20.1  6.03  1.07  17.9  22.3  10.4  33.9

Formatting overall mean and 95% CI

mtcars %>%
  mean_table(mpg) %>%
  mean_format(
    recipe = "mean (lcl - ucl)",
    name = "mean_95",
    digits = 1
  ) %>% 
  select(response_var, mean_95)
#> # A tibble: 1 × 2
#>   response_var mean_95           
#>   <chr>        <chr>             
#> 1 mpg          20.1 (17.9 - 22.3)

Formatting grouped means table with mean and sd

mtcars %>%
  group_by(cyl) %>%
  mean_table(mpg) %>%
  mean_format("mean (sd)") %>% 
  select(response_var:group_cat, formatted_stats)
#> # A tibble: 3 × 4
#>   response_var group_var group_cat formatted_stats
#>   <chr>        <chr>         <dbl> <chr>          
#> 1 mpg          cyl               4 26.66 (4.51)   
#> 2 mpg          cyl               6 19.74 (1.45)   
#> 3 mpg          cyl               8 15.1 (2.56)

Grouped means table with defaults

mtcars %>% 
  group_by(cyl) %>% 
  mean_table(mpg)
#> # A tibble: 3 × 11
#>   response_var group_var group_cat     n  mean    sd   sem   lcl   ucl   min
#>   <chr>        <chr>         <dbl> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 mpg          cyl               4    11  26.7  4.51 1.36   23.6  29.7  21.4
#> 2 mpg          cyl               6     7  19.7  1.45 0.549  18.4  21.1  17.8
#> 3 mpg          cyl               8    14  15.1  2.56 0.684  13.6  16.6  10.4
#> # … with 1 more variable: max <dbl>
Metadata

Version

0.1.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows