R-CMD-check

tables

The goal of tables is to compute and display complex tables of summary statistics.

Output may be in LaTeX, HTML, plain text, or an R matrix for further processing.

Installation

You can install the release version of orientlib using

install.packages("tables")

You can install the development version of tables from GitHub with:

# install.packages("devtools")
devtools::install_github("dmurdoch/tables")

Example

This is a basic example which shows you how to solve a common problem:

library(tables)

# In an R Markdown document, you don't want each table
# to output the HTML document header, so turn 
# off that option:

table_options(htmloptions(head=FALSE))

X <- rnorm(125, sd=100)
Group <- factor(sample(letters[1:5], 125, rep=TRUE))
tab <- tabular( Group ~ 
                  (N=1) +
                  Format(digits=2)*X*
                    ((Mean=mean) +
                     Heading("Std Dev")*sd) 
              )

# To print in plain text:
tab
#>                        
#>           X            
#>  Group N  Mean  Std Dev
#>  a     27  14.2  95.1  
#>  b     22   0.2  78.5  
#>  c     31  34.1 100.4  
#>  d     22  12.1 114.5  
#>  e     23  19.8  92.8

# To format in HTML:
toHTML(tab)
    X
Group N Mean Std Dev
a 27 14.2 95.1
b 22 0.2 78.5
c 31 34.1 100.4
d 22 12.1 114.5
e 23 19.8 92.8

To generate LaTeX code:

cat(toLatex(tab)$text) #>