{"id":15901,"date":"2020-04-27T14:49:12","date_gmt":"2020-04-27T13:49:12","guid":{"rendered":"https:\/\/www.datanovia.com\/en\/?post_type=dt_lessons&#038;p=15901"},"modified":"2020-04-27T14:51:21","modified_gmt":"2020-04-27T13:51:21","slug":"highchart-interactive-boxplot-in-r","status":"publish","type":"dt_lessons","link":"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/","title":{"rendered":"Highchart Interactive Boxplot in R"},"content":{"rendered":"<div id=\"rdoc\">\n<div id=\"intrduction\" class=\"section level2\">\n<h2>Intrduction<\/h2>\n<p>This article describes how to create an <strong>interactive boxplot in R<\/strong> using the highcharter R package.<\/p>\n<\/div>\n<p>Contents:<\/p>\n<div id=\"TOC\">\n<ul>\n<li><a href=\"#intrduction\">Intrduction<\/a><\/li>\n<li><a href=\"#loading-required-r-packages\">Loading required R packages<\/a><\/li>\n<li><a href=\"#data-preparation\">Data preparation<\/a><\/li>\n<li><a href=\"#horizontal-boxplots\">Horizontal boxplots<\/a><\/li>\n<li><a href=\"#vertical-boxplots\">Vertical boxplots<\/a><\/li>\n<li><a href=\"#grouped-boxplots\">Grouped boxplots<\/a><\/li>\n<\/ul>\n<\/div>\n<div id=\"loading-required-r-packages\" class=\"section level2\">\n<h2>Loading required R packages<\/h2>\n<pre class=\"r\"><code># Load required R packages\r\nlibrary(dplyr)\r\nlibrary(highcharter) \r\n# Set highcharter options\r\noptions(highcharter.theme = hc_theme_smpl(tooltip = list(valueDecimals = 2)))<\/code><\/pre>\n<\/div>\n<div id=\"data-preparation\" class=\"section level2\">\n<h2>Data preparation<\/h2>\n<pre class=\"r\"><code>data(\"ToothGrowth\")\r\nToothGrowth$dose &lt;- as.factor(ToothGrowth$dose)\r\nhead(ToothGrowth, 4)<\/code><\/pre>\n<pre><code>##    len supp dose\r\n## 1  4.2   VC  0.5\r\n## 2 11.5   VC  0.5\r\n## 3  7.3   VC  0.5\r\n## 4  5.8   VC  0.5<\/code><\/pre>\n<\/div>\n<div id=\"horizontal-boxplots\" class=\"section level2\">\n<h2>Horizontal boxplots<\/h2>\n<pre class=\"r\"><code>hc &lt;- hcboxplot(\r\n  x = ToothGrowth$len,\r\n  var = ToothGrowth$dose,\r\n  name = \"Tooth Length\", \r\n  color = \"#2980b9\"\r\n  ) <\/code><\/pre>\n<pre class=\"r\"><code>hc<\/code><\/pre>\n<p><iframe width=\"95%\" height=\"450\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/highcharter\/figures\/005-highcharter-box-plot-horizontal-boxplots.html\" frameborder=\"2\"><br \/>\n<\/iframe><\/p>\n<\/div>\n<div id=\"vertical-boxplots\" class=\"section level2\">\n<h2>Vertical boxplots<\/h2>\n<pre class=\"r\"><code>hc &lt;- hcboxplot(\r\n  x = ToothGrowth$len,\r\n  var = ToothGrowth$dose,\r\n  outliers = FALSE,\r\n  color = \"#2980b9\"\r\n  ) %&gt;% \r\n  hc_chart(type = \"column\")<\/code><\/pre>\n<pre class=\"r\"><code>hc<\/code><\/pre>\n<p><iframe width=\"95%\" height=\"450\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/highcharter\/figures\/005-highcharter-box-plot-vertical-boxplots.html\" frameborder=\"2\"><br \/>\n<\/iframe><\/p>\n<\/div>\n<div id=\"grouped-boxplots\" class=\"section level2\">\n<h2>Grouped boxplots<\/h2>\n<pre class=\"r\"><code>hc &lt;- hcboxplot(\r\n  x = ToothGrowth$len,\r\n  var = ToothGrowth$dose,\r\n  var2 = ToothGrowth$supp,\r\n  outliers = FALSE\r\n  ) %&gt;% \r\n  hc_chart(type = \"column\")<\/code><\/pre>\n<pre class=\"r\"><code>hc<\/code><\/pre>\n<p><iframe width=\"95%\" height=\"450\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/highcharter\/figures\/005-highcharter-box-plot-grouped-boxplots.html\" frameborder=\"2\"><br \/>\n<\/iframe><\/p>\n<\/div>\n<\/div>\n<p><!--end rdoc--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Describes how to create an interactive boxplot in R using the highcharter R package.<\/p>\n","protected":false},"author":1,"featured_media":9152,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","class_list":["post-15901","dt_lessons","type-dt_lessons","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Highchart Interactive Boxplot in R: The Essentials - Datanovia<\/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:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Highchart Interactive Boxplot in R: The Essentials - Datanovia\" \/>\n<meta property=\"og:description\" content=\"Describes how to create an interactive boxplot in R using the highcharter R package.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Datanovia\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-27T13:51:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040265.JPG.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/\",\"name\":\"Highchart Interactive Boxplot in R: The Essentials - Datanovia\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040265.JPG.jpg\",\"datePublished\":\"2020-04-27T13:49:12+00:00\",\"dateModified\":\"2020-04-27T13:51:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/#primaryimage\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040265.JPG.jpg\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040265.JPG.jpg\",\"width\":1024,\"height\":512},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.datanovia.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lessons\",\"item\":\"https:\/\/www.datanovia.com\/en\/lessons\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Highchart Interactive Boxplot in R\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"name\":\"Datanovia\",\"description\":\"Data Mining and Statistics for Decision Support\",\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.datanovia.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\",\"name\":\"Datanovia\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"width\":98,\"height\":99,\"caption\":\"Datanovia\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Highchart Interactive Boxplot in R: The Essentials - Datanovia","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:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/","og_locale":"en_US","og_type":"article","og_title":"Highchart Interactive Boxplot in R: The Essentials - Datanovia","og_description":"Describes how to create an interactive boxplot in R using the highcharter R package.","og_url":"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/","og_site_name":"Datanovia","article_modified_time":"2020-04-27T13:51:21+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040265.JPG.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/","url":"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/","name":"Highchart Interactive Boxplot in R: The Essentials - Datanovia","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/#primaryimage"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040265.JPG.jpg","datePublished":"2020-04-27T13:49:12+00:00","dateModified":"2020-04-27T13:51:21+00:00","breadcrumb":{"@id":"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/#primaryimage","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040265.JPG.jpg","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2019\/05\/P1040265.JPG.jpg","width":1024,"height":512},{"@type":"BreadcrumbList","@id":"https:\/\/www.datanovia.com\/en\/lessons\/highchart-interactive-boxplot-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.datanovia.com\/en\/"},{"@type":"ListItem","position":2,"name":"Lessons","item":"https:\/\/www.datanovia.com\/en\/lessons\/"},{"@type":"ListItem","position":3,"name":"Highchart Interactive Boxplot in R"}]},{"@type":"WebSite","@id":"https:\/\/www.datanovia.com\/en\/#website","url":"https:\/\/www.datanovia.com\/en\/","name":"Datanovia","description":"Data Mining and Statistics for Decision Support","publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.datanovia.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.datanovia.com\/en\/#organization","name":"Datanovia","url":"https:\/\/www.datanovia.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","width":98,"height":99,"caption":"Datanovia"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/"}}]}},"multi-rating":{"mr_rating_results":[]},"_links":{"self":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/15901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons"}],"about":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/types\/dt_lessons"}],"author":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/comments?post=15901"}],"version-history":[{"count":2,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/15901\/revisions"}],"predecessor-version":[{"id":15903,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/dt_lessons\/15901\/revisions\/15903"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media\/9152"}],"wp:attachment":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media?parent=15901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}