<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/explore-your-mcdonalds-meal-with-shiny-and-d3partitionr/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://enhancedatascience.com/2017/10/02/macdonalds-shiny-d3partitionr/"> Enhance Data Science</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Have you ever wondered what was in your MacDonalds menu? Or in your DoubleCheese Burger (well it’s my favorite one)? A wonderful dataset was released a few months ago, it contains all the nutrition facts from McDonald’s items. You can find the dataset <a rel="nofollow" href="https://www.kaggle.com/mcdonalds/nutrition-facts" target="_blank">here</a>.</p>
<p>In addition to this, I released a new version of <a rel="nofollow" href="http://enhancedatascience.com/2017/09/20/d3partitionr-0-5-beta/" target="_blank">D3partitionR</a> a few weeks ago and was looking for use cases. Hierarchical charts like Sunburst or Treemap are very useful to split and analyze the composition of categories and items. Hence, I decided to make a small Shiny application to analyze the composition and the nutrition value of a MacDonald’s menu.</p>
<p><a rel="nofollow" href="https://www.enhancedata.tech/McExplorer/" target="_blank"><strong>And here is the app!</strong></a></p>
<h2>Application functionalities</h2>
<p>The application has four main tabs:</p>
<ol>
<li>Menu selection</li>
<li>Calories explorer</li>
<li>Nutrients explorer</li>
<li>Daily Value explorer</li>
</ol>
<h3>Menu Selection</h3>
<p>The menu selection is used to … select the items you want to add to your menus. Most of MacDonalds’s items are in there, and there are ordered according to their categories.</p>
<h3>Calories explorer</h3>
<p>Far more interesting! This part will show you how the calories are spread between the different items, categories, and nutrients (Carbohydrates, Total fat, fibers, and proteins). The zooming makes it easy to see the precise calories composition of each item or categories.</p>
<p><img data-orig-file="https://i1.wp.com/enhancedatascience.com/wp-content/uploads/2017/10/tab2_MacExplorer-1.png?fit=1896%2C891" data-orig-size="1896,891" data-medium-file="https://i1.wp.com/enhancedatascience.com/wp-content/uploads/2017/10/tab2_MacExplorer-1.png?fit=300%2C141" data-attachment-id="2360" data-image-meta="{" data-image-description="" src="https://i1.wp.com/enhancedatascience.com/wp-content/uploads/2017/10/tab2_MacExplorer-1.png?resize=640%2C301" data-permalink="http://enhancedatascience.com/2017/10/02/macdonalds-shiny-d3partitionr/tab2_macexplorer-2/" data-large-file="https://i1.wp.com/enhancedatascience.com/wp-content/uploads/2017/10/tab2_MacExplorer-1.png?fit=640%2C301" alt="Calories explorer" data-image-title="Calories explorer" sizes="(max-width: 640px) 100vw, 640px" data-comments-opened="1" class="wp-image-2360" data-recalc-dims="1"></p>
<h3>Daily value and Nutrients explorer</h3>
<p>Since calories are not the only element to take into accounts to assess a meal, these two tabs show the value of the different nutrients and their daily value (taken from McDonalds’s website). Various nutrients are available like Saturated fat, Sodium, Vitamin A, … The main point of these tabs was to show a reproducible way to imitate facetting with D3partitionR (which can probably be extended to other widgets).</p>
<p><a rel="nofollow" href="http://enhancedatascience.com/2017/10/02/macdonalds-shiny-d3partitionr/#gallery-2355-1-slideshow" target="_blank">Click to view slideshow.</a></p>
<h2>Application Technicalities</h2>
<p>The charts in the application mainly rely on D3partitionR and show the main functionalities of D3partitionR:</p>
<ul>
<li>Plotting different types of hierarchical charts with a unified interface</li>
<li>Zooming and interactivity with the chart.</li>
<li>Shiny bindings as showed in tab 2 where the ggplot is linked to the clicked node.</li>
</ul>
<p>The application code can be found on <a rel="nofollow" href="https://github.com/AntoineGuillot2/McMenuExplorer" target="_blank">Github</a>.</p>
<p>The post <a rel="nofollow" href="http://enhancedatascience.com/2017/10/02/macdonalds-shiny-d3partitionr/" target="_blank">Explore your McDonalds Meal with Shiny and D3partitionR</a> appeared first on <a rel="nofollow" href="http://enhancedatascience.com/" target="_blank">Enhance Data Science</a>.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://enhancedatascience.com/2017/10/02/macdonalds-shiny-d3partitionr/"> Enhance Data Science</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/SDH-06tP_f8" height="1"></a></div>