https://github.com/sciviews/tabularise
Create tabular outputs for various R objects (based on {flextable})
https://github.com/sciviews/tabularise
r r-package sciviews tabulation
Last synced: 12 months ago
JSON representation
Create tabular outputs for various R objects (based on {flextable})
- Host: GitHub
- URL: https://github.com/sciviews/tabularise
- Owner: SciViews
- License: other
- Created: 2023-08-08T12:30:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-04T11:31:26.000Z (almost 2 years ago)
- Last Synced: 2024-05-04T12:31:44.302Z (almost 2 years ago)
- Topics: r, r-package, sciviews, tabulation
- Language: R
- Homepage: https://www.sciviews.org/tabularise
- Size: 7.52 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
---
title: "Create Tabular Outputs from R
"
output: github_document
---
[](https://github.com/SciViews/tabularise/actions/workflows/R-CMD-check.yaml) [](https://app.codecov.io/gh/SciViews/tabularise?branch=main) [](https://CRAN.R-project.org/package=tabularise) [](https://sciviews.r-universe.dev/tabularise) [](https://opensource.org/licenses/MIT) [](https://lifecycle.r-lib.org/articles/stages.html#experimental)
```{r setup, include = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>",
fig.path = "man/figures/README-", out.width = "100%")
library(tabularise)
```
With {tabularise} you should be able to obtain publication-ready (rich-formatted) tabular output from different R objects. It uses and enhances the {flextable} package to build these tables and allow to output them in HTML, LaTeX/PDF, Word or PowerPoint. See for more details.
## Installation
{tabularise} is not available from CRAN yet. You should install it from the [SciViews R-Universe](https://sciviews.r-universe.dev). The {equatags} and {equatiomatic} packages are optional, but they are useful to display equations, both inline in R Markdown/Quarto documents and in {tabularise} tables. The {data.io} package is useful too because it manages labels and units that {chart} uses. To install those three packages and their dependencies, run the following command in R:
```{r, eval=FALSE}
install.packages(c('tabularise', 'equatags', 'equatiomatic', 'data.io'),
repos = c('https://sciviews.r-universe.dev', 'https://cloud.r-project.org'))
```
You can also install the latest development version of {tabularise}. Make sure you have the {remotes} R package installed:
```{r, eval=FALSE}
# install.packages("remotes")
remotes::install_github("SciViews/tabularise")
```
## Short example
Let's take the well-known `iris` data frame, to which we add labels and units.
```{r}
data("iris")
# Add labels and units
iris <- data.io::labelise(iris,
label = list(
Sepal.Length = "Sepal length", Sepal.Width = "Sepal width",
Petal.Length = "Petal length", Petal.Width = "Petal width",
Species = "Iris species"),
units = list(
Sepal.Length = "cm", Sepal.Width = "cm",
Petal.Length = "cm", Petal.Width = "cm"))
```
Once the labels and units have been added to our data frame, the `tabularise()` function uses them automatically in the tables it produces.
```{r, warning=FALSE, message=FALSE}
library(tabularise)
tabularise$headtail(iris) # or tabularise(iris, type = "headtail")
```
{tabularise} is a central package used by several other packages in the SciViews universe to format its tabular outputs. Various methods are available for `tabularise()` and they are further enhanced by other packages, such as [{inferit}](https://www.sciviews.org/inferit/) and [{modelit}](https://www.sciviews.org/modelit/).
## Code of Conduct
Please note that the {tabularise} package is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.