Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dmurdoch/tables

Formula-Driven Table Generation
https://github.com/dmurdoch/tables

Last synced: about 22 hours ago
JSON representation

Formula-Driven Table Generation

Awesome Lists containing this project

README

        

---
output: github_document
---

[![R-CMD-check](https://github.com/dmurdoch/tables/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/dmurdoch/tables/actions/workflows/R-CMD-check.yaml)

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# 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

``` r
install.packages("tables")
```

You can install the development version of tables from [GitHub](https://github.com/) with:

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

## Example

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

```{r example}
library(tables)

set.seed(123)

# 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, replace = TRUE))
tab <- tabular( Group ~
(N=1) +
Format(digits=2)*X*
((Mean=mean) +
Heading("Std Dev")*sd)
)

# To print in plain text:
tab

# To format in HTML:
toHTML(tab)
```
```{r}
# To generate LaTeX code:
strsplit(toLatex(tab)$text, "\n")
```