README.md

printsheet

Easily create human-readable spreadsheets with R. Printsheet aims to tansform your data into a human readable form, described, styled and linked. We are currently working up a beta release, if you would like to help, let me know at chris.dangerfield@gmail.com.

The vision

Ever finished a piece of analysis and wanted to give the results to your stakeholders, but the first thing they have to do is open it and resize the columns, add a filter, or copy some data into another workbook to make it useful to them? Printsheet aims to make some assumptions in this process to automate the creation of human readable spreadsheets.

With one function, the dataset is exported to xlsx, with columns resized, and saved with an appropriate name in the working directory:

printsheet(mtcars)

With a formula it exports files and sheets:

library(dplyr)
m <- add_rownames(mtcars, "Name")
printsheet(m, formula = Name ~ .) # Exports a file per car name, with all data on one sheet
printsheet(m, formula = . ~ Name) # Exports one file with one sheet per car name, and an index sheet

A description is added to the index sheet with a basic R markdown file:

printsheet(m, formula = . ~ Name, description = "desc.Rmd")

And the title of the file can be changed to something meaningful:

printsheet(m, formula = . ~ Name, description = "desc.Rmd", title = "Motor Trend Car Road Tests")

If a two column definitions data frame is provided, a link will be created to a "definitions" sheet from the colunn headings:

printsheet(m, formula = . ~ Name, definitions = mtcars_defs)

Styles can be added through a JSON style sheet:

printsheet(m, formula = . ~ Name, styles = "path-to-local-style-sheet.json")

Logos can be added as either a link to a file or a weblink (the logo will be resized automatically):

printsheet(m, formula = . ~ Name, logo = "https://web-link-to-logo.png")

Fine tuning settings can also be created through JSON style sheet, so that corporate colour schemes, and style can be used from a single location:

printsheet(m, formula = . ~ Name, settings = "path-to-local-settings-sheet.json")

A simple zip command creates the files in a single zip directory:

printsheet(m, formula = Name ~ ., zip = TRUE)

Colours are interpolated from a character vector and used to colour tabs in the workbook and provide some colour on the title sheet:

printsheet(m, formula = Name ~ ., colours = c("#eeeeee", "#999999"))

The viridis colour palette will be used by default with others in that series such as "inferno" being able to be specified by name in the colours parameter:

printsheet(m, formula = Name ~ ., colours = "inferno")

Proposed features



chris-dangerfield/printsheet documentation built on July 9, 2020, 4 p.m.