How to call Cognitive Services APIs with R

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Microsoft Cognitive Services 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 “AI” type features to applications. A good example is the “Seeing AI” glasses in the video below: the image descriptions, emotion inference, and text recognition are all driven by Cognitive Services APIs.

You can call these APIs from any application, including R. Here are a few examples:

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 httr package to call the API. Input and output is standard JSON, which we can create and extract using the jsonlite package.

(There's also an independent R interface to the text APIs. And there are already Python SDKs for many of the services, including the Face API.)

Shohbit has also published a step-by-step guide to calling Cognitive Services APIs 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 register for a Cognitive Services API key. Rate-limited keys (more than enough to test out the service) are free, and you can register using your GitHub account.

Big Data Enthusiast: Microsoft Cognitive Services (Text Analytics API) in R

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)