<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/cucumber-time-food-on-a-2d-plate-plane/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://longhowlam.wordpress.com/2018/07/27/cucumber-time-food-on-a-2d-plate-plane/"> R – Longhow Lam's Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><img data-orig-file="https://longhowlam.files.wordpress.com/2018/07/komkommer.jpeg?w=316&amp;h=210&amp;fit=316%2C210&amp;resize=316%2C210" data-orig-size="275,183" data-medium-file="https://longhowlam.files.wordpress.com/2018/07/komkommer.jpeg?w=316&amp;h=210&amp;fit=316%2C210&amp;resize=316%2C210?w=275" data-attachment-id="2648" data-image-meta="{" data-image-description="" src="https://longhowlam.files.wordpress.com/2018/07/komkommer.jpeg?w=316&h=210&fit=316%2C210&resize=316%2C210" data-permalink="https://longhowlam.wordpress.com/2018/07/27/cucumber-time-food-on-a-2d-plate-plane/komkommer/" data-large-file="https://longhowlam.files.wordpress.com/2018/07/komkommer.jpeg?w=316&amp;h=210&amp;fit=316%2C210&amp;resize=316%2C210?w=275" alt="komkommer" data-image-title="komkommer" sizes="(max-width: 316px) 100vw, 316px" width="316" data-comments-opened="1" class="wp-image-2648" data-recalc-dims="1" height="210"></p>
<h2>Introduction</h2>
<p>It is 35 degree Celsius out side, we are in the middle of the ‘slow news season’, in many countries also called <strong>cucumber time</strong>.  A period typified by the appearance of less informative and frivolous news in the media.</p>
<p>Did you know that 100 g of cucumber contain 0.28 mg of iron and 1.67 g of sugar? You can find all the nutrient values of a cucumber on <a rel="nofollow" href="https://ndb.nal.usda.gov/ndb/search/list" target="_blank">the USDA food databases</a>.</p>
<h2>Food Data</h2>
<p>There is more data, for many thousands of products you can retrieve nutrient values through an API (need to register for a free KEY). So besides the cucumber I extracted data for different type of food for example</p>
<ul>
<li>Beef products</li>
<li>Dairy &amp; Egg products</li>
<li>Vegetables</li>
<li>Fruits</li>
<li>etc.</li>
</ul>
<p>And as a comparison, I retrieved the nutrient values for some fast food products from McDonald’s and Pizza Hut. Just to see if <a rel="nofollow" href="http://www.thejournal.ie/us-congress-rules-that-pizza-is-a-vegetable-282033-Nov2011/" target="_blank">pizza can be classified  as vegetable</a> from a data point of view <img alt="🙂" src="https://i0.wp.com/s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f642.png?w=456&ssl=1" class="wp-smiley" data-recalc-dims="1"> So the data looks like:</p>
<p><img data-orig-file="https://longhowlam.files.wordpress.com/2018/07/selection_078.png?w=450&amp;h=172&amp;fit=696%2C172" data-orig-size="1585,392" data-medium-file="https://longhowlam.files.wordpress.com/2018/07/selection_078.png?w=450&amp;h=172&amp;fit=696%2C172?w=300" data-attachment-id="2649" data-image-meta="{" data-image-description="" src="https://longhowlam.files.wordpress.com/2018/07/selection_078.png?w=450&h=172&fit=696%2C172" data-permalink="https://longhowlam.wordpress.com/2018/07/27/cucumber-time-food-on-a-2d-plate-plane/selection_078/" data-large-file="https://longhowlam.files.wordpress.com/2018/07/selection_078.png?w=450&amp;h=172&amp;fit=696%2C172?w=440" alt="Selection_078" data-image-title="Selection_078" sizes="(max-width: 696px) 100vw, 696px" data-comments-opened="1" class="wp-image-2649" data-recalc-dims="1"></p>
<p>I have sampled 1500 products and per product we have 34 nutrient values.</p>
<h2>Results</h2>
<p>The 34 dimensional data is now compressed / projected onto a two dimensional plane using UMAP (<a rel="nofollow" href="https://github.com/lmcinnes/umap" target="_blank">Uniform Manifold Approximation and Projection</a>). There is a Python and R package to this.</p>
<p><img data-orig-file="https://longhowlam.files.wordpress.com/2018/07/selection_079.png?w=456" data-orig-size="1005,700" data-medium-file="https://longhowlam.files.wordpress.com/2018/07/selection_079.png?w=456?w=300" data-attachment-id="2650" data-image-meta="{" data-image-description="" src="https://longhowlam.files.wordpress.com/2018/07/selection_079.png?w=456" data-permalink="https://longhowlam.wordpress.com/2018/07/27/cucumber-time-food-on-a-2d-plate-plane/selection_079/" data-large-file="https://longhowlam.files.wordpress.com/2018/07/selection_079.png?w=456?w=440" alt="Selection_079" data-image-title="Selection_079" sizes="(max-width: 440px) 100vw, 440px" data-comments-opened="1" class="wp-image-2650" data-recalc-dims="1"></p>
<p>An interactive map can be found <a rel="nofollow" href="https://longhowlam.github.io/food_in2D.html" target="_blank">here</a>, and the R code to retrieve and plot the data <a rel="nofollow" href="https://github.com/longhowlam/foodcomposition" target="_blank">here</a>. Cheers, Longhow.</p>
<p> </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="https://longhowlam.wordpress.com/2018/07/27/cucumber-time-food-on-a-2d-plate-plane/"> R – Longhow Lam's Blog</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/_UCLgKZbV6c" height="1"></a></div>