Trying to connect to the yelp API using R and library ROAuth.
Great python sample using the rauth module and geo-coordinates:
https://gist.github.com/phill
After the author of ROAuth recommended using library(httr) and because of the lack of simple yelp examples in R using either libraries, I figured others may be looking for this too. This will return either 10 bars in the Chicago area by name, or 10 bars in San Francisco by geo-coordinates. Replace the x's with your own yelp account keys. (this is pieced together from many sources- thanks to all of them).
# yelp
consumerKey = "xxxx"
consumerSecret = "xxxx"
token = "xxxx"
token_secret = "xxxx"
require(httr)
require(httpuv)
require(jsonlite)
# authorization
myapp = oauth_app("YELP", key=consumerKey, secret=consumerSecret)
sig=sign_oauth1.0(myapp, token=token,token_secret=token_secret)
limit <- 10
# 10 bars in Chicago
yelpurl <- paste0("http://api.yelp.com/v2/search/?limit=",limit,"&location=Chicago%20IL&term=bar")
# or 10 bars by geo-coordinates
yelpurl <- paste0("http://api.yelp.com/v2/search/?limit=",limit,"&ll=37.788022,-122.399797&term=bar")
locationdata=GET(yelpurl, sig)
locationdataContent = content(locationdata)
locationdataList=jsonlite::fromJSON(toJSON(locationdataContent))
head(data.frame(locationdataList))