

{"id":4040,"date":"2016-03-04T11:58:36","date_gmt":"2016-03-04T16:58:36","guid":{"rendered":"http:\/\/rud.is\/b\/?p=4040"},"modified":"2018-03-07T16:42:46","modified_gmt":"2018-03-07T21:42:46","slug":"capturing-wild-widgets-with-webshot","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/","title":{"rendered":"Capturing wild widgets with webshot"},"content":{"rendered":"<p>NOTE: you won&#8217;t need to use this function if you use the [development version](https:\/\/github.com\/yihui\/knitr) of `knitr`<\/p>\n<hr\/>\n<p>Winston Chang released his [`webshot`](https:\/\/github.com\/wch\/webshot) package to CRAN this past week. The package wraps the immensely useful [`phantomjs`](http:\/\/phantomjs.org\/) utility and makes it dirt simple to capture whole or partial web pages in R. One beautiful bonus feature of `webshot` is that you can install `phamtomjs` with it (getting `phantomjs` to work on Windows is a pain).<\/p>\n<p>You can do many things with the `webshot` package but I hastily drafted this post to put forth a means to generate a static image from an `htmlwidget`. I won&#8217;t elaborate much since I included a fully `roxygen`-doc&#8217;d function below, but the essence of `capture_widget()` is to pass in an `htmlwidget` object and have it rendered for you to a `png` file and get back either:<\/p>\n<p>&#8211; a file system `path` reference (e.g. `\/path\/to\/widget.png`)<br \/>\n&#8211; a `markdown` image reference (e.g. `![](file:\/\/\/path\/to\/widget.png)`)<br \/>\n&#8211; an `html` image reference (e.g. `<img src='file:\/\/\/path\/to\/widget.png'\/>`), or<br \/>\n&#8211; an `inline` base64 encoded HTML imgage reference (e.g. `<img src='data:image\/png;base64,iVBORw...'\/>`)<\/p>\n<p>which you can then use in R markdown documents knitted to PDF (or in any other context).<\/p>\n<p>Take a look at the function, poke the tyres and drop suggestions in the comments. I&#8217;ll add this to one of my widgets soon so folks can submit complaints or enhancements via issues &#038; PRs on github). <\/p>\n<p>To use the function, just pipe a sized widget to it and use the output from it.<\/p>\n<pre lang=\"rsplus\">#' Capture a static (png) version of a widget (e.g. for use in a PDF knitr document)\r\n#'\r\n#' Widgets are generally interactive beasts rendered in an HTML DOM with\r\n#' javascript. That makes them unusable in PDF documents. However, many widgets\r\n#' initial views would work well as static images. This function renders a widget\r\n#' to a file and make it usable in a number of contexts.\r\n#'\r\n#' What is returned depends on the value of \\code{output}. By default (\\code{\"path\"}),\r\n#' the full disk path will be returned. If \\code{markdown} is specified, a markdown\r\n#' string will be returned with a \\code{file:\/\/\/...} URL. If \\code{html} is\r\n#' specified, an \\code{<img src='file:\/\/\/...'\/>} tag will be returned and if\r\n#' \\code{inline} is specified, a base64 encoded \\code{<img>} tag will be returned\r\n#' (just like you'd see in a self-contained HTML file from \\code{knitr}).\r\n#'\r\n#' @importFrom webshot webshot\r\n#' @importFrom base64 img\r\n#' @param wdgt htmlwidget to capture\r\n#' @param output how to return the results of the capture (see Details section)\r\n#' @param height,width it's important for many widget to be responsive in HTML\r\n#'        documents. PDFs are static beasts and having a fixed image size works\r\n#'        better for them. \\code{height} & \\code{width} will be passed into the\r\n#'        rendering process, which means you should probably specify similar\r\n#'        values in your widget creation process so the captured \\code{<div>}\r\n#'        size matches the size you specify here.\r\n#' @param png_render_path by default, this will be a temporary file location but\r\n#'        a fully qualified filename (with extension) can be specified. It's up to\r\n#'        the caller to free the storage when finished with the resource.\r\n#' @return See Details\r\n#' @export\r\ncapture_widget <- function(wdgt,\r\n                           output=c(\"path\", \"markdown\", \"html\", \"inline\"),\r\n                           height, width,\r\n                           png_render_path=tempfile(fileext=\".png\")) {\r\n\r\n  wdgt_html_tf <- tempfile(fileext=\".html\")\r\n\r\n  htmlwidgets::saveWidget(vl, wdgt_html_tf)\r\n\r\n  webshot::webshot(url=sprintf(\"file:\/\/%s\", wdgt_html_tf),\r\n                   selector=\"#htmlwidget_container\",\r\n                   file=wdgt_png_tf,\r\n                   vwidth=width, vheight=height)\r\n\r\n  # done with HTML\r\n  unlink(wdgt_html_tf)\r\n\r\n  switch(match.arg(output, c(\"path\", \"markdown\", \"html\", \"inline\")),\r\n             `path`=png_render_path,\r\n         `markdown`=sprintf(\"![widget](file:\/\/%s)\", png_render_path),\r\n             `html`=sprintf(\"<img src='file:\/\/%s'\/>\", png_render_path),\r\n           `inline`=base64::img(wdgt_png_tf))\r\n\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>NOTE: you won&#8217;t need to use this function if you use the [development version](https:\/\/github.com\/yihui\/knitr) of `knitr` Winston Chang released his [`webshot`](https:\/\/github.com\/wch\/webshot) package to CRAN this past week. The package wraps the immensely useful [`phantomjs`](http:\/\/phantomjs.org\/) utility and makes it dirt simple to capture whole or partial web pages in R. One beautiful bonus feature of `webshot` [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[765,724,91],"tags":[810],"class_list":["post-4040","post","type-post","status-publish","format-standard","hentry","category-htmlwidgets","category-phantomjs","category-r","tag-post"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Capturing wild widgets with webshot - rud.is<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Capturing wild widgets with webshot - rud.is\" \/>\n<meta property=\"og:description\" content=\"NOTE: you won&#8217;t need to use this function if you use the [development version](https:\/\/github.com\/yihui\/knitr) of `knitr` Winston Chang released his [`webshot`](https:\/\/github.com\/wch\/webshot) package to CRAN this past week. The package wraps the immensely useful [`phantomjs`](http:\/\/phantomjs.org\/) utility and makes it dirt simple to capture whole or partial web pages in R. One beautiful bonus feature of `webshot` [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-04T16:58:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-07T21:42:46+00:00\" \/>\n<meta property=\"og:image\" content=\"\" \/>\n<meta name=\"author\" content=\"hrbrmstr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"hrbrmstr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Capturing wild widgets with webshot\",\"datePublished\":\"2016-03-04T16:58:36+00:00\",\"dateModified\":\"2018-03-07T21:42:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/\"},\"wordCount\":274,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/#primaryimage\"},\"thumbnailUrl\":\"file:\\\/\\\/\\\/path\\\/to\\\/widget.png\",\"keywords\":[\"post\"],\"articleSection\":[\"htmlwidgets\",\"phantomjs\",\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/\",\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/\",\"name\":\"Capturing wild widgets with webshot - rud.is\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/#primaryimage\"},\"thumbnailUrl\":\"file:\\\/\\\/\\\/path\\\/to\\\/widget.png\",\"datePublished\":\"2016-03-04T16:58:36+00:00\",\"dateModified\":\"2018-03-07T21:42:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/#primaryimage\",\"url\":\"file:\\\/\\\/\\\/path\\\/to\\\/widget.png\",\"contentUrl\":\"file:\\\/\\\/\\\/path\\\/to\\\/widget.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2016\\\/03\\\/04\\\/capturing-wild-widgets-with-webshot\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/rud.is\\\/b\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Capturing wild widgets with webshot\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#website\",\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/\",\"name\":\"rud.is\",\"description\":\"&quot;In God we trust. All others must bring data&quot;\",\"publisher\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/rud.is\\\/b\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\",\"name\":\"hrbrmstr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\",\"width\":460,\"height\":460,\"caption\":\"hrbrmstr\"},\"logo\":{\"@id\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/ukr-shield.png?fit=460%2C460&ssl=1\"},\"description\":\"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7\",\"sameAs\":[\"http:\\\/\\\/rud.is\"],\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/author\\\/hrbrmstr\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Capturing wild widgets with webshot - rud.is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/","og_locale":"en_US","og_type":"article","og_title":"Capturing wild widgets with webshot - rud.is","og_description":"NOTE: you won&#8217;t need to use this function if you use the [development version](https:\/\/github.com\/yihui\/knitr) of `knitr` Winston Chang released his [`webshot`](https:\/\/github.com\/wch\/webshot) package to CRAN this past week. The package wraps the immensely useful [`phantomjs`](http:\/\/phantomjs.org\/) utility and makes it dirt simple to capture whole or partial web pages in R. One beautiful bonus feature of `webshot` [&hellip;]","og_url":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/","og_site_name":"rud.is","article_published_time":"2016-03-04T16:58:36+00:00","article_modified_time":"2018-03-07T21:42:46+00:00","og_image":[{"url":"file:\/\/\/path\/to\/widget.png","type":"","width":"","height":""}],"author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Capturing wild widgets with webshot","datePublished":"2016-03-04T16:58:36+00:00","dateModified":"2018-03-07T21:42:46+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/"},"wordCount":274,"commentCount":1,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/#primaryimage"},"thumbnailUrl":"file:\/\/\/path\/to\/widget.png","keywords":["post"],"articleSection":["htmlwidgets","phantomjs","R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/","url":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/","name":"Capturing wild widgets with webshot - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/#primaryimage"},"thumbnailUrl":"file:\/\/\/path\/to\/widget.png","datePublished":"2016-03-04T16:58:36+00:00","dateModified":"2018-03-07T21:42:46+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/#primaryimage","url":"file:\/\/\/path\/to\/widget.png","contentUrl":"file:\/\/\/path\/to\/widget.png"},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2016\/03\/04\/capturing-wild-widgets-with-webshot\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Capturing wild widgets with webshot"}]},{"@type":"WebSite","@id":"https:\/\/rud.is\/b\/#website","url":"https:\/\/rud.is\/b\/","name":"rud.is","description":"&quot;In God we trust. All others must bring data&quot;","publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/rud.is\/b\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886","name":"hrbrmstr","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","width":460,"height":460,"caption":"hrbrmstr"},"logo":{"@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1"},"description":"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7","sameAs":["http:\/\/rud.is"],"url":"https:\/\/rud.is\/b\/author\/hrbrmstr\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p23idr-13a","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":3298,"url":"https:\/\/rud.is\/b\/2015\/03\/09\/new-r-package-ipapi-ipdomain-geolocation\/","url_meta":{"origin":4040,"position":0},"title":"New R Package &#8211; ipapi (IP\/Domain Geolocation)","author":"hrbrmstr","date":"2015-03-09","format":false,"excerpt":"I noticed that the @rOpenSci folks had an interface to [ip-api.com](http:\/\/ip-api.com\/) on their [ToDo](https:\/\/github.com\/ropensci\/webservices\/wiki\/ToDo) list so I whipped up a small R package to fill said gap. Their IP Geolocation API will take an IPv4, IPv6 or FQDN and kick back a ASN, lat\/lon, address and more. The [ipapi package](https:\/\/github.com\/hrbrmstr\/ipapi)\u2026","rel":"","context":"In &quot;cartography&quot;","block_context":{"text":"cartography","link":"https:\/\/rud.is\/b\/category\/cartography\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3386,"url":"https:\/\/rud.is\/b\/2015\/05\/09\/quotebox-an-npr-like-embedded-twitter-quote-generator\/","url_meta":{"origin":4040,"position":1},"title":"quotebox &#8211; An NPR-like Embedded Twitter Quote Generator","author":"hrbrmstr","date":"2015-05-09","format":false,"excerpt":"I'm an avid NPR listener also follow a number of their programs and people on Twitter. I really dig their [quotable](https:\/\/github.com\/nprapps\/quotable) tweets. Here's a sample of a recent one: Minn. state senators cannot look other senators in the eye during floor debate. @ailsachang http:\/\/t.co\/SfQBq4yyHQ pic.twitter.com\/DNHGEiVA9j\u2014 NPR News (@nprnews) May 8,\u2026","rel":"","context":"In &quot;phantomjs&quot;","block_context":{"text":"phantomjs","link":"https:\/\/rud.is\/b\/category\/phantomjs\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3278,"url":"https:\/\/rud.is\/b\/2015\/02\/15\/introducing-the-streamgraph-htmlwidget-r-pacakge\/","url_meta":{"origin":4040,"position":2},"title":"Introducing the streamgraph htmlwidget R Package","author":"hrbrmstr","date":"2015-02-15","format":false,"excerpt":"We were looking for a different type of visualization for a project at work this past week and my thoughts immediately gravitated towards [streamgraphs](http:\/\/www.leebyron.com\/else\/streamgraph\/). The TLDR on streamgraphs is they they are generalized versions of stacked area graphs with free baselines across the x axis. They are somewhat [controversial](http:\/\/www.visualisingdata.com\/index.php\/2010\/08\/making-sense-of-streamgraphs\/) but\u2026","rel":"","context":"In &quot;d3&quot;","block_context":{"text":"d3","link":"https:\/\/rud.is\/b\/category\/d3\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8230,"url":"https:\/\/rud.is\/b\/2018\/02\/16\/pym-js-library-vulnerability-in-widgetframe-package\/","url_meta":{"origin":4040,"position":3},"title":"Pym.js Library Vulnerability in widgetframe Package","author":"hrbrmstr","date":"2018-02-16","format":false,"excerpt":"What's Up? The NPR Visuals Team created and maintains a javascript library that makes it super easy to embed iframes on web pages and have said documents still be responsive. The widgetframe R htmlwidget uses pym.js to bring this (much needed) functionality into widgets and (eventually) shiny apps. NPR reported\u2026","rel":"","context":"In &quot;Cybersecurity&quot;","block_context":{"text":"Cybersecurity","link":"https:\/\/rud.is\/b\/category\/cybersecurity\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3914,"url":"https:\/\/rud.is\/b\/2016\/02\/04\/alternate-r-markdown-templates\/","url_meta":{"origin":4040,"position":4},"title":"Alternate R Markdown Templates","author":"hrbrmstr","date":"2016-02-04","format":false,"excerpt":"The `knitr`\/R markdown system is a great way to organize reports and analyses. However, the built-in ones (that come with RStudio\/the `rmarkdown` package) rely on Bootstrap and also use jQuery. There's nothing wrong with that, but the generated standalone HTML documents (which are a great way to distribute reports) don't\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3243,"url":"https:\/\/rud.is\/b\/2015\/02\/01\/new-release-0-7-of-metricsgraphics-htmlwidget-grids-rollovers\/","url_meta":{"origin":4040,"position":5},"title":"New release (0.7) of metricsgraphics htmlwidget \u2014 grids &#038; rollovers","author":"hrbrmstr","date":"2015-02-01","format":false,"excerpt":"I've updated my [metricsgraphics](https:\/\/github.com\/hrbrmstr\/metricsgraphics) package to version [0.7](https:\/\/github.com\/hrbrmstr\/metricsgraphics\/releases\/tag\/v0.7). The core [MetricsGraphics](http:\/\/metricsgraphicsjs.org) JavaScript library has been updated to version 2.1.0 (from 1.1.0). Two blog-worthy features since releasing version 0.5 are `mjs_grid` (which is a `grid.arrange`-like equivalent for `metricsgraphics` plots and `mjs_add_rollover` which lets you add your own custom rollover text to\u2026","rel":"","context":"In &quot;Charts &amp; Graphs&quot;","block_context":{"text":"Charts &amp; Graphs","link":"https:\/\/rud.is\/b\/category\/charts-graphs\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/4040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/comments?post=4040"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/4040\/revisions"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=4040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=4040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=4040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}