<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/how-to-call-cognitive-services-apis-with-r/"></div></div><div><a data-url="https://www.r-bloggers.com/how-to-call-cognitive-services-apis-with-r/" data-counturl="https://www.r-bloggers.com/how-to-call-cognitive-services-apis-with-r/" data-count="horizontal" data-text="How to call Cognitive Services APIs with R" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2016/11/how-to-call-cognitive-services-apis-with-r.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>Microsoft <a target="_blank" rel="nofollow" href="https://www.microsoft.com/cognitive-services">Cognitive Services</a> is a set of cloud-based machine-intelligence APIs that you can use to extract structured data from complex sources (unstructured text, images, video and audio), and add &quot;AI&quot; type features to applications. A good example is the &quot;Seeing AI&quot; glasses in the video below: the image descriptions, emotion inference, and text recognition are all driven by Cognitive Services APIs.</p>
<p><iframe height="281" allowfullscreen="" width="500" src="https://www.youtube.com/embed/R2mC-NUAmMk"></iframe></p>
<p>You can call these APIs from any application, including R. Here are a few examples:</p>
<ul>
<li>In a blog post a few months back, I called the <a target="_blank" rel="nofollow" href="https://www.microsoft.com/cognitive-services/en-us/face-api">Face API</a> from R to determine the apparent <a target="_blank" rel="nofollow" href="http://blog.revolutionanalytics.com/2016/06/programmers-gender.html">gender of programmers</a> according to their GitHub avatar.</li>
<li>The Economist used the <a target="_blank" rel="nofollow" href="https://www.microsoft.com/cognitive-services/en-us/emotion-api">Emotion API</a> to track the <a target="_blank" rel="nofollow" href="https://benheubl.github.io/data%20analysis/fr/">emotions of the US presidential candidates</a> during the debates.</li>
<li>Shohbit at the Big Data Enthusiast blog used the <a target="_blank" rel="nofollow" href="https://www.microsoft.com/cognitive-services/en-us/text-analytics-api">Text Analytics API</a> to chart the <a target="_blank" rel="nofollow" href="https://bigdataenthusiast.wordpress.com/2016/11/05/sentimental-analysis-in-r/">sentiment of tweets from the candidates</a>.</li>
</ul>
<p>There's no official R package (yet!) for calling Cognitive Services APIs. But since every Cognitive Service API is just a standard REST API, we can use the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/httr/">httr package</a> to call the API. Input and output is standard JSON, which we can create and extract using the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/jsonlite/">jsonlite package</a>.</p>
<p>(There's also an <a target="_blank" rel="nofollow" href="https://github.com/philferriere/mscstexta4r">independent R interface to the text APIs</a>. And there are already Python SDKs for many of the services, including the <a target="_blank" rel="nofollow" href="https://www.microsoft.com/cognitive-services/en-us/face-api/documentation/get-started-with-face-api/GettingStartedwithFaceAPIinPython#sdk-install">Face API</a>.)</p>
<p>Shohbit has also published a step-by-step guide to calling <a target="_blank" rel="nofollow" href="https://bigdataenthusiast.wordpress.com/2016/10/02/microsoft-cognitive-services-text-analytics-api-in-r/">Cognitive Services APIs</a> from R, with several examples of using the Text Analytics API. The details are at the link below. To get started, all you'll need is to <a target="_blank" rel="nofollow" href="https://www.microsoft.com/cognitive-services/en-us/sign-up">register for a Cognitive Services API key</a>. Rate-limited keys (more than enough to test out the service) are free, and you can register using your GitHub account.</p>
<p>Big Data Enthusiast: <a target="_blank" rel="nofollow" href="https://bigdataenthusiast.wordpress.com/2016/10/02/microsoft-cognitive-services-text-analytics-api-in-r/">Microsoft Cognitive Services (Text Analytics API) in R</a></p>
</div>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/how-to-call-cognitive-services-apis-with-r/"></div></div><div><a data-url="https://www.r-bloggers.com/how-to-call-cognitive-services-apis-with-r/" data-counturl="https://www.r-bloggers.com/how-to-call-cognitive-services-apis-with-r/" data-count="vertical" data-text="How to call Cognitive Services APIs with R" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.revolutionanalytics.com/2016/11/how-to-call-cognitive-services-apis-with-r.html"> Revolutions</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 title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/1hr5MUyIlk8"></a></div>