Skip to content

emilyriederer/wigo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wigo

Lifecycle: experimental

The goal of wigo is to make it easier to understand how an RMarkdown is generating its output by toggling the knit engine. wigo will help you understand what is going on in an RMarkdown document by outputting tables under each chunk with information about the state of the environment.

Specifically, instead of normal chunk output, wigo outputs a table containing columns for each object in the enviornment and describing its:

  • status (created, modified, unchanged, removed)
  • name
  • type
  • class
  • dimensions (rows x columns for dataframes and length otherwise)
  • object size
  • name of chunk in which variable was created or last modified

A new row is added to this table either when a new object is added to the environment or when the dimensions of a current object change. Currently, the actual contents of objects are not inspected.

wigo contains two flavors out this output. Setting engine = 'wigo' will result in a report of the complete environment after every chunk. Alternatively, engine = 'wigo_diff' will report only changes to the environement (e.g. not the 'unchanged' category).

Installation

You can install the development version of wigo from GitHub with:

remotes::install_git('emily_riederer/wigo')

Note that this package is extremely experimental, untested, and subject to change.

Example

You can toggle the language engine of your RMarkdown document to wigo by adding this to the set-up chunk of your RMarkdown:

library(wigo)
register_eng_wigo()
knitr::opts_chunk$set(engine = 'wigo')

to see a full description of the environment and any changes at each point in time, or

library(wigo)
register_eng_wigo()
knitr::opts_chunk$set(engine = 'wigo_diff')

to see only the environment diff.

By doing so, you can input such as:

to output like:

or like this with the wigo_diff engine:

Assumptions & Limitations

  • wigo assumes all chunks in your RMarkdown are currently R chunk, and it requires that you globally set the rendering engine to wigo instead. Currently, the underlying logic will not work particularly well for a single chunk
  • For a given variable name, wigo detects changes to to an object's class, type, size, or dimensions but not its underlying contents. For example, in the image above, no changes are detected for y after we do the computation y <- y+1 because this does not meaningfully change any of elements listed above although it clearly changes the value
  • Additionally, wigo currently works exclusively for HTML output

About

knitr engine to help understand what is going on in an unruly RMarkdown script

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages