{"id":15118701,"url":"https://github.com/Merck/r2rtf","last_synced_at":"2025-09-28T01:30:36.328Z","repository":{"id":37418915,"uuid":"241737369","full_name":"Merck/r2rtf","owner":"Merck","description":"Easily Create Production-Ready Rich Text Format (RTF) Table and Figure","archived":false,"fork":false,"pushed_at":"2024-09-30T21:18:17.000Z","size":11859,"stargazers_count":78,"open_issues_count":6,"forks_count":20,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-01-13T01:02:53.354Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://merck.github.io/r2rtf","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Merck.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-19T22:10:51.000Z","updated_at":"2024-12-02T09:24:04.000Z","dependencies_parsed_at":"2023-10-11T05:28:50.261Z","dependency_job_id":"2e7698ef-4968-41d1-a88c-478a5c54107a","html_url":"https://github.com/Merck/r2rtf","commit_stats":{"total_commits":336,"total_committers":18,"mean_commits":"18.666666666666668","dds":0.4910714285714286,"last_synced_commit":"c9d4712426a95c305e60be1db43107fbb72d06d3"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merck%2Fr2rtf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merck%2Fr2rtf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merck%2Fr2rtf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merck%2Fr2rtf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Merck","download_url":"https://codeload.github.com/Merck/r2rtf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234475315,"owners_count":18839358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-26T01:53:36.772Z","updated_at":"2025-09-28T01:30:36.318Z","avatar_url":"https://github.com/Merck.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n# r2rtf \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"120\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/r2rtf)](https://CRAN.R-project.org/package=r2rtf)\n[![Codecov test coverage](https://codecov.io/gh/Merck/r2rtf/graph/badge.svg)](https://app.codecov.io/gh/Merck/r2rtf)\n[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/r2rtf)](https://cran.r-project.org/package=r2rtf)\n[![R-CMD-check](https://github.com/Merck/r2rtf/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Merck/r2rtf/actions/workflows/R-CMD-check.yaml)\n[![status](https://tinyverse.netlify.app/badge/r2rtf)](https://cran.r-project.org/package=r2rtf)\n\u003c!-- badges: end --\u003e\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE)\n```\n\n```{r, echo = FALSE}\npkgname \u003c- \"r2rtf\"\n```\n\n## Overview\n\nr2rtf is an R package to create production-ready tables and figures in RTF format.\nThe package is designed with these principles:\n\n- Provide simple \"verb\" functions that correspond to each component of a table,\n  to help you translate data frame(s) to a table in RTF file.\n- Functions are chainable with pipes (`%\u003e%`).\n- Only focus on **table format**.\n  - Data manipulation and analysis should be handled by other R packages, for example, tidyverse.\n- Minimize package dependency.\n\nThe [R for clinical study reports and submission](https://r4csr.org/) book\nprovides tutorials by using real world examples.\n\n## Installation\n\nYou can install the package via CRAN:\n\n```r\ninstall.packages(\"r2rtf\")\n```\n\nOr, install from GitHub:\n\n```r\nremotes::install_github(\"Merck/r2rtf\")\n```\n\n## Highlighted features\n\nThe R package r2rtf provides flexibility to enable features below:\n\n- Create highly customized RTF tables and figures ready for production.\n- Simple to use parameters and data structure.\n  - Customized column header: split by `\"|\"`.\n  - Three required parameters for the output tables (data, filename, column relative width).\n  - Flexible and detail control of table structure.\n- Format control in cell, row, column and table level for:\n  - Border Type: single, double, dash, dot, etc.\n  - Alignment: left, right, center, decimal.\n  - Column width.\n  - Text appearance: **bold**, *italics*, ~~strikethrough~~, underline and any combinations.\n  - Font size.\n  - Text and border color (`r length(colors())` different colors named in `color()` function).\n  - Special characters: any character in UTF-8 encoding (e.g., Greek, Symbol, Chinese, Japanese, Korean).\n- Append several tables into one file.\n- Pagination.\n- Built-in raw data for validation.\n\n## Simple example\n\n```{r, eval = FALSE}\nlibrary(dplyr)\nlibrary(r2rtf)\n\nhead(iris) %\u003e%\n  rtf_body() %\u003e% # Step 1 Add attributes\n  rtf_encode() %\u003e% # Step 2 Convert attributes to RTF encode\n  write_rtf(file = \"ex-tbl.rtf\") # Step 3 Write to a .rtf file\n```\n\n```{r, include=FALSE}\nlibrary(r2rtf)\ntry(\n  {\n    pdftools::pdf_convert(\"vignettes/pdf/ex-tbl.pdf\", dpi = 200, filenames = \"ex-tbl.png\")\n    pdftools::pdf_convert(\"vignettes/pdf/efficacy_example.pdf\", dpi = 200, filenames = \"efficacy_example.png\")\n    pdftools::pdf_convert(\"vignettes/pdf/ae_example.pdf\", dpi = 200, filenames = \"ae_example.png\")\n    files \u003c- c(\"ex-tbl.png\", \"efficacy_example.png\", \"ae_example.png\")\n    file.copy(from = files, to = file.path(\"vignettes/fig\", files), overwrite = TRUE)\n    file.remove(files)\n  },\n  silent = TRUE\n)\n```\n\n\u003cdetails\u003e\u003csummary\u003eClick here to see the output\u003c/summary\u003e\n\u003cimg src=\"https://merck.github.io/r2rtf/articles/fig/ex-tbl.png\"\u003e\n\u003c/details\u003e\n\n- [More Examples](https://merck.github.io/r2rtf/articles/index.html)\n\n## Example efficacy table\n\n- [Source code](https://merck.github.io/r2rtf/articles/example-efficacy.html)\n\n\u003cdetails\u003e\u003csummary\u003eClick here to see the output\u003c/summary\u003e\n\u003cimg src=\"https://merck.github.io/r2rtf/articles/fig/efficacy_example.png\"\u003e\n\u003c/details\u003e\n\n## Example safety table\n\n- [Source code](https://merck.github.io/r2rtf/articles/example-ae-summary.html)\n\n\u003cdetails\u003e\u003csummary\u003eClick here to see the output\u003c/summary\u003e\n\u003cimg src=\"https://merck.github.io/r2rtf/articles/fig/ae_example.png\"\u003e\n\u003c/details\u003e\n\n```{r, include=FALSE, eval = FALSE}\n# Transfer all RTF files to PDF files\nfiles \u003c- list.files(\"vignettes/rtf\", pattern = \"*.rtf\", full.names = TRUE)\n\nr2rtf:::rtf_convert_format(\n  input = files,\n  format = \"pdf\",\n  output_dir = \"vignettes/pdf\"\n)\n\nr2rtf:::rtf_convert_format(\n  input = files,\n  format = \"docx\",\n  output_dir = \"vignettes/docx\"\n)\n\nr2rtf:::rtf_convert_format(\n  input = files,\n  format = \"html\",\n  output_dir = \"vignettes/html\"\n)\n\nfiles \u003c- list.files(\"vignettes/rtf\", pattern = \"*\\\\.rtf\")\nfiles_pdf \u003c- list.files(\"vignettes/pdf\", pattern = \"*\\\\.pdf\")\nfiles_docx \u003c- list.files(\"vignettes/docx\", pattern = \"*\\\\.docx\")\nfiles_html \u003c- list.files(\"vignettes/html\", pattern = \"*\\\\.html\")\n\n# Compare RTF and PDF folder filenames.\nwaldo::compare(\n  tools::file_path_sans_ext(files),\n  tools::file_path_sans_ext(files_pdf)\n)\n\nwaldo::compare(\n  tools::file_path_sans_ext(files),\n  tools::file_path_sans_ext(files_docx)\n)\n\nwaldo::compare(\n  tools::file_path_sans_ext(files),\n  tools::file_path_sans_ext(files_html)\n)\n```\n\n## Citation\n\nIf you use this software, please cite it as below.\n\n\u003e Wang, S., Ye, S., Anderson, K., \u0026 Zhang, Y. (2020).\n\u003e r2rtf---an R Package to Produce Rich Text Format (RTF) Tables and Figures.\n\u003e _PharmaSUG_. https://pharmasug.org/proceedings/2020/DV/PharmaSUG-2020-DV-198.pdf\n\nA BibTeX entry for LaTeX users is\n\n```bibtex\n@inproceedings{wang2020r2rtf,\n  title     = {{r2rtf}---an {R} Package to Produce {Rich Text Format} ({RTF}) Tables and Figures},\n  author    = {Wang, Siruo and Ye, Simiao and Anderson, Keaven M and Zhang, Yilong},\n  booktitle = {PharmaSUG},\n  year      = {2020},\n  url       = {https://pharmasug.org/proceedings/2020/DV/PharmaSUG-2020-DV-198.pdf}\n}\n```\n","funding_links":[],"categories":["Ranked by starred repositories"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMerck%2Fr2rtf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMerck%2Fr2rtf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMerck%2Fr2rtf/lists"}