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).
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.
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:
wigo
assumes all chunks in your RMarkdown are currently R chunk, and it requires that you globally set the rendering engine towigo
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 fory
after we do the computationy <- 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