MyNixOS website logo
Description

Easily Create Production-Ready Rich Text Format (RTF) Table and Figure.

Create production-ready Rich Text Format (RTF) table and figure with flexible format.

r2rtf

CRANstatus Codecov testcoverage CRANDownloads R-CMD-check status

Overview

r2rtf is an R package to create production-ready tables and figures in RTF format. The package is designed with these principles:

  • Provide simple “verb” functions that correspond to each component of a table, to help you translate data frame(s) to a table in RTF file.
  • Functions are chainable with pipes (%>%).
  • Only focus on table format.
    • Data manipulation and analysis should be handled by other R packages, for example, tidyverse.
  • Minimize package dependency.

The R for clinical study reports and submission book provides tutorials by using real world examples.

Installation

You can install the package via CRAN:

install.packages("r2rtf")

Or, install from GitHub:

remotes::install_github("Merck/r2rtf")

Highlighted features

The R package r2rtf provides flexibility to enable features below:

  • Create highly customized RTF table and figure ready for production.
  • Simple to use parameters and data structure.
    • Customized column header: split by "|".
    • Three required parameters for the output tables (data, filename, column relative width).
    • Flexible and detail control of table structure.
  • Format control in cell, row, column and table level for:
    • Border Type: single, double, dash, dot, etc.
    • Alignment: left, right, center, decimal.
    • Column width.
    • Text appearance: bold, italics, strikethrough, underline and any combinations.
    • Font size.
    • Text and border color (657 different colors named in color() function).
    • Special characters: any character in UTF-8 encoding (e.g., Greek, Symbol, Chinese, Japanese, Korean).
  • Append several tables into one file.
  • Pagination.
  • Built-in raw data for validation.

Simple example

library(dplyr)
library(r2rtf)

head(iris) %>%
  rtf_body() %>% # Step 1 Add attributes
  rtf_encode() %>% # Step 2 Convert attributes to RTF encode
  write_rtf(file = "ex-tbl.rtf") # Step 3 Write to a .rtf file
Click here to see the output

Example efficacy table

Click here to see the output

Example safety table

Click here to see the output

Citation

If you use this software, please cite it as below.

Wang, S., Ye, S., Anderson, K., & Zhang, Y. (2020). r2rtf—an R Package to Produce Rich Text Format (RTF) Tables and Figures. PharmaSUG. https://www.pharmasug.org/proceedings/2020/DV/PharmaSUG-2020-DV-198.pdf

A BibTeX entry for LaTeX users is

@inproceedings{wang2020r2rtf,
  title     = {{r2rtf}---an {R} Package to Produce {Rich Text Format} ({RTF}) Tables and Figures},
  author    = {Wang, Siruo and Ye, Simiao and Anderson, Keaven M and Zhang, Yilong},
  booktitle = {PharmaSUG},
  year      = {2020},
  url       = {https://www.pharmasug.org/proceedings/2020/DV/PharmaSUG-2020-DV-198.pdf}
}
Metadata

Version

1.1.1

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