Description Usage Arguments Details Value
A step is an introduction of a new object or a new plot to the session. Graph of steps is easier to read for humans than a graph of commits becase only the relevant (new) information is shown in each node of the graph. Thus, translating from commits to steps is the first step to visualize the history stored in commits.
commit_to_steps
generates a list
with two elements:
steps
with a separate entry for each variable/plot that matches
the objects
filter
links
which defines links (graph edges) between steps
introduced_in
generates the filter for
commit_to_steps
's objects
parameter. It does it by comparing the
contents of the commit id
against the contents of its parent.
read_objects
reads every object/plot and fills in the
contents
or desc
ription. It is particularly useful when initial
steps
graph has been read without objects' contents, e.g. in
query_by.
find_root_id
searches for the single commit
in the graph without a parent.
format
prepares the expression for display
in a HTML page.
description
format the expression for display
in a HTML page.
plot_to_dependencies
processes the steps
list and
either:
extracts plots into png`` files, which are then attached to the html widget via
dependencies' (see htmltools::htmlDependency)
embeds the png bitmap as base64-encoded string under the contents
key
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | graph_to_steps(graph)
commit_to_steps(commit, objects)
introduced_in(graph, id)
read_objects(s, store)
find_root_id(g)
format_expression(code)
description(object)
plot_to_dependencies(steps, embed = is_knitr())
|
graph |
Object returned by |
commit |
A |
objects |
Filter for objects present in the commit. |
id |
Identifier of a commit in |
s |
|
store |
An object store object, e.g. storage::filesystem. |
g |
A graph object. |
code |
R |
object |
Object to be described. |
steps |
A list of |
embed |
Whether to embed plots as base64-encoded strings. |
graph_to_steps
is the main function that orchestrates the
transformation.
The value returned by commit_to_steps
is a list
that
contains two named elements: steps
and links
, whose values are
again list
s. The steps
list holds description of objects present
in the commit that also matched the filter defined in the argument
objects
. The links
list defines graph edges among steps
; edges
are arbitrary as all objects are actually created in the same commit.
Each element in the steps
list is itself a list
that represents
either an R object or a plot. Both alternatives share the following
keys:
type
- either 'object'
or 'plot'
id
- object's identifier in the repository (sha1)
expr
- expression that produced this object (assigned to its parent commit)
parent
- id (sha1) of this object's parent commit
If type
is equal to 'object'
, the followin keys are also present:
name
- name of the variable in the commit (R's environment
) which the object was assigned to
desc
- textual description, auto-generated
Alternatively, if type
is equal to 'plot'
, the followin key is
also present:
contents
- base64-encoded graphics
Object of S3 class steps
.
commit_to_steps
returns a list
of steps
and links
.
introduced_in
returns a character
vector.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.