forked from insightsengineering/rtables
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
91 lines (65 loc) · 2.83 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# rtables
[![Build Status](https://travis-ci.org/Roche/rtables.svg?branch=master)](https://travis-ci.org/Roche/rtables/)
## Reporting tables with R
The `rtables` R package is a prototype to create and display complex tables with
R. The cells in an `rtable` may contain any high-dimensional data structure
which can then be displayed with cell-specific formatting instructions. Currently,
`rtables` can be outputted in `ascii` and `html`.
Some of our requirements and reasons to create this new table package are:
* multiple values displayed within a cell
* values need to be programmatically accessible for cross-checking
* flexible formatting (cell spans, rounding, alignment, etc.)
* composition of an `rtable` object from other rtable objects
* multiple output formats (html, ascii, latex, pdf)
* flexible pagination
Note that the current state of `rtables` does not fulfill all of those
requirements. We are looking for collaborators, see the next section.
## Collaboration and Planned API Changes
The current state of the `rtables` functionality is a first rough prototype. We
will be changing the API significantly in the coming months without maintaining
backward compatibility. We will release the `rtable` package on
[CRAN](https://cran.r-project.org/) once we have a stable version.
We are looking for collaborators to help define and shape the `rtables` package.
Please [contact me](mailto:[email protected]) if you would like to align
your contributions to the current development plans or feel free to fork the
repository and to send us pull requests with the suggested improvements.
## Installation
To install the stable release of `rtables` package run the following command in `R`:
```{r, eval = FALSE}
devtools::install_github("roche/rtables", ref="v0.1.1")
```
To install the test version of `rtables` run
```{r, eval = FALSE}
devtools::install_github("roche/rtables")
```
## Usage
```{r}
library(rtables)
tbl <- rtable(
header = c("Treatement\nN=100", "Comparison\nN=300"),
format = "xx (xx.xx%)",
rrow("A", c(104, .2), c(100, .4)),
rrow("B", c(23, .4), c(43, .5)),
rrow(),
rrow("this is a very long section header"),
rrow("estimate", rcell(55.23, "xx.xx", colspan = 2)),
rrow("95% CI", indent = 1, rcell(c(44.8, 67.4), format = "(xx.x, xx.x)", colspan = 2))
)
tbl
```
## Presentations
* [Presentation on v0.1.0 April 2018](https://docs.google.com/presentation/d/1bpdBDp4PZdZ4hCsfaPkAuHDVnJmtp7WBIZ19oKMDq0M/edit?usp=sharing)
* [baselR November
2017](https://docs.google.com/presentation/d/1V28AVo9aVNfw2FTuRgQyM4BJKalVQMFD8lKUD2KlzKI/edit?usp=sharing),
this presentation was written for version `v0.0.1`