The rlistings
R package is a package that was designed to create and
display listings with R. The focus of this package is to provide
functionality for value formatting and ASCII rendering infrastructure
for tables and listings. Many of the functions contained in rlistings
depend on the
formatters
package, which provides a framework for ASCII rendering and is available
on CRAN.
rlistings
development is driven by the need to create regulatory ready
listings for health authority review. Some of the key requirements for
this undertaking are listed below:
- flexible formatting (pagesize, column widths, alignment, labels, etc.)
- multiple output formats (csv, out, txt)
- repeated key columns
- flexible pagination in both horizontal and vertical directions
- titles and footnotes
rlistings
currently covers some of these requirements, and remains
under active development.
rlistings
is available on CRAN and you can install the latest released
version with:
install.packages("rlistings")
or you can install the latest development version directly from GitHub with:
# install.packages("pak")
pak::pak("insightsengineering/rlistings")
Packaged releases (both those on CRAN and those between official CRAN releases) can be found in the releases list.
To understand how to use this package, please refer to the Introduction
to
rlistings
article, which provides multiple examples of code implementation.
The following example shows a simple listing and its printed output.
library(rlistings)
#> Loading required package: formatters
#>
#> Attaching package: 'formatters'
#> The following object is masked from 'package:base':
#>
#> %||%
#> Loading required package: tibble
# Reducing the data
mtcars_ex <- mtcars %>% dplyr::mutate("car" = rownames(mtcars))
as_listing(mtcars_ex,
key_cols = c("gear", "carb"),
disp_cols = c("gear", "carb", "qsec", "car")
) %>% head()
#> gear carb qsec car
#> βββββββββββββββββββββββββββββββββββββββ
#> 3 1 19.44 Hornet 4 Drive
#> 20.22 Valiant
#> 20.01 Toyota Corona
#> 2 17.02 Hornet Sportabout
#> 16.87 Dodge Challenger
#> 17.3 AMC Javelin
This package is a result of a joint effort by many developers and stakeholders. We would like to thank everyone who contributed so far!