{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false, "jupyter": { "outputs_hidden": false } }, "outputs": [], "source": [ "library(IRdisplay)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The IRkernel already displays things automatically, but the [`IRdisplay` package](http://irkernel.github.io/docs/IRdisplay/0.4.4/) allows to programmatically access this machinery.\n", "\n", "You can display all standard formats of an object via [`display`](http://irkernel.github.io/docs/IRdisplay/0.4.4/display.html). This uses [`repr_*`](http://irkernel.github.io/docs/repr/0.8/repr-generics.html) and the [`jupyter.display_mimetypes` option](http://irkernel.github.io/docs/IRdisplay/0.4.4/IRdisplay-options.html):" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false, "jupyter": { "outputs_hidden": false } }, "outputs": [ { "data": { "text/html": [ "$jupyter.display_mimetypes = \n", "
| display {IRdisplay} | R Documentation |
Both functions create a mimebundle for multiple reprs.\n",
"display proceeds to publish it using publish_mimebundle.\n",
"prepare_mimebundle returns it (see Value for details)\n",
"
\n",
"display(obj, ..., mimetypes = getOption(\"jupyter.display_mimetypes\"),\n",
" error_handler = stop)\n",
"\n",
"prepare_mimebundle(obj,\n",
" mimetypes = getOption(\"jupyter.display_mimetypes\"), metadata = NULL,\n",
" error_handler = stop)\n",
"\n",
"\n",
"\n",
"obj | \n",
"\n",
" The object to create representations for \n", " |
mimetypes | \n",
"\n",
" Mimetypes to create reprs for. The defaults are defined by the option |
error_handler | \n",
"\n",
" Function used when errors in individual reprs occur \n", " |
metadata, ... | \n",
"\n",
" Metadata to attach to the result (can be expanded by additional metadata) \n", " |
prepare_mimebundle returns a list with items corresponding to the parameters of publish_mimebundle (data and metadata)\n",
"
publish_mimebundle\n",
"
\n",
"bundle <- prepare_mimebundle(diag(3))\n",
"\n",
"## Not run: ## (Run inside of an IRkernel)\n",
"display(help(display))\n",
"## End(Not run)\n",
"\n",
"\n",
"\n",
"