Learn R Programming

repfun

R Reporting Functions Repository

This repository contains an R package of reporting functions that mimic (HARP) traditional macros for clinical reporting. The package can be used to generate Tables, Listings and Figures. See several examples in the Vignettes/Articles.

How to Use This Package

  1. Download and install the package from CRAN (see below), or using the zip file repfun_0.1.2.tar.gz (in "misc" branch), or via library remotes (see below).
  2. Load the library in an R session.
  3. Review the function documentation under References (https://gsk-biostatistics.github.io/repfun/reference/index.html).
  4. Identify a use case that fits your needs from the Articles (https://gsk-biostatistics.github.io/repfun/articles/index.html).
  5. Copy and modify the Vignette code for your study.

General Information

Built With

Getting Started

Prerequisites

# Before using repfun, install the following R packages:
install.packages(c("tidyr","dplyr","ggplot2","magrittr","Hmisc","haven","stringr","admiral","lubridate","r2rtf")) 

License

This project is released under the Apache-2.0 license.

Contact

For any questions or comments about this project, please contact Yongwei Wang or Chris Rook.

Acknowledgments

Acknowledgement to the following useful sources:

Copy Link

Version

Install

install.packages('repfun')

Version

0.1.2

License

Apache License (== 2.0)

Issues

Pull Requests

Stars

Forks

Maintainer

Chris Rook

Last Published

January 26th, 2026

Functions in repfun (0.1.2)

rem_pg_nums

Remove floating page numbers from RTF files.
ru_contents

Generate proc contents of data frame similar to that generated by SAS
ru_addpage

Add a Page Number Column to an Existing Dataframe
ru_data2codelist

Return a list with codelist, code and label based on input codelist dataset.
%>%

Pipe operator
rs_setup

Pass values to setup function and the global environment will be arranged for use reporting tools.
ru_align

Align Columns for Reporting
ru_addbignvar

Assign Big N to Data Frame.
ru_addsupp

Cobmine an SDTM domain with its corresponding Supplemental data set
repfun-package

repfun: Create Tables, Listings and Figures using Functions Styled after SAS™ Macros
ru_datacompare

Compare 2 data frames and report differences.
ru_groupbyvars

Modify groupbyvars by adding or removing decode vars.
ru_labels

Assign labels to variables in a data frame
ru_expvarlist

Expand SAS Style Variable/Column List
ru_denorm

Transpose a Data Frame
ru_datetime

Add numeric datetimes to data frame that only has character versions.
ru_freq

Create Percentage based on Numerator and Denominator Data
ru_getdata

Assign Big N to Data Frame.
ru_fillcodedcode

Fill missing code/decode records
suppdm

Supplemental Demography
ru_libname

Automate retrieval of data sets/frames in specified folder.
ru_fillna

Fill NA values with specified values or zeros/blanks by default.
ru_list

R function to mimic the SAS macro %tu_list.
suppae

Supplemental Adverse Events
ru_load_library

Load a list of libraries
ru_stackvar

Stack Columns of a Dataframe into New Column
ru_sumstats

Calculate Descriptive Statistics
ru_width_rtf

Create a List of Relative Widths of Columns for RTF Outputs
ru_setdata

Append data sets even when variables do not match
advs

ADaM ADVS
copydata

Copy package data to the directory specified.
adsl

ADaM ADSL
mtcars_w2lbls

This is the mtcars data frame with labels added for columns mpg and cyl.
airquality_4test

Updated airquality for testing.
formats

Data frame of SAS formats
adae

ADaM ADAE
airquality_updated

Updated airquality
dm

Demography
ae

Adverse Events