Description Usage Arguments Value Examples
Create a notebook file based on the metadata (e.g.,title and author, etc) and the content.
1 2 3 |
file |
the notebook filename |
title |
the title of the notebook |
author |
the author of the notebook |
date |
the date for the notebook |
... |
other metadata for the notebook |
body |
the body of the notebook; a default list of content is used if
not provided, otherwise it should be a list of sub-lists, with each
sub-list being a list of elements |
The notebook filename (a temporary file by default, with the prefix
rnotebook
). The metadata and content are written to the file as a
JSON string.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | f = rnotebook::newnb()
rnotebook::refresh(f) # compile the notebook
file.show(f)
f2 = rnotebook::newnb('foo-test.Rnb', author = 'R. A. Fisher', body = list(
list(type = 'text', src = 'Hello **world**.', out = NULL),
list(type = 'code', src = list(
options = '', code = 'fisher.test(matrix(c(3, 1, 1, 3), 2))'
), out = '')
))
file.show(f2)
rnotebook::refresh(f2)
# serve notebooks using the servr package (click the .Rnb filenames)
if (!requireNamespace('servr') || packageVersion('servr') < '0.1.10')
install.packages('servr', repos = 'http://yihui.name/xran')
if (interactive()) servr::notebook()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.