JSEvals | R Documentation |
It works by transforming list(foo = list(1, list(bar =
I('function(){}')), 2))
to list("foo.2.bar")
. Later on the JS side,
the window.HTMLWidgets.evaluateStringMember
function is called with
the JSON object and the "foo.2.bar" string, which is split to ['foo',
'2', 'bar']
, and the string at that location is replaced in-situ with
the results of evaluating it. Note '2' (character) should have been 2
(integer) but it does not seem to matter in JS: x[2] is the same as x['2']
when all child members of x are unnamed, and ('2' in x) will be true even if
x is an array without names. This is a little hackish.
JSEvals(list)
list |
a list in which the elements that should be evaluated as JavaScript are to be identified |
This function is intended mostly for internal use. There's generally no need
for widget authors or users to call it, as it's called automatically on the
widget instance data during rendering. It's exported in case other packages
want to add support for JS
in contexts outside of widget
payloads.
Yihui Xie
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.