Reputation: 763
I was wondering if anyone know how i could access facebook API from within R.. I would like, to access the text in my wall post, and do very basic analysis. The problem is that, aside from the fact that my knowledge of text mining is very basic, my knowledge of how to use web-api (if that is even a correct concept), is non-existing.
Assuming that i have an api-key, can someone provide me with a very basic example/code to demonstrate how i could make the connection from R to facebook, and download some data? I imagine i will need one or more R packages, such as: Rcurl, Rjson...
My main focus right now is to learn/improve my text mining skills in R, and so i don't want to get lost into/distracted by basic programing to access facebook api.
Finally, i read in the comment on a related question Update Facebook status using R? that
"...it's not like you can pull large amounts of data from Facebook to do data analysis...".
Can anyone elaborate on that?
Thanx
Upvotes: 5
Views: 13493
Reputation: 81
you can use Rfacebook package from following link to access Facebook API http://cran.r-project.org/web/packages/Rfacebook/Rfacebook.pdf. Further to this, you can use advance text mining packages within R for text mining on the feed.
A more comprehensive help is here http://pablobarbera.com/blog/archives/3.html
An example on how to use it is here
http://thinktostart.wordpress.com/2013/11/19/analyzing-facebook-with-r/
Upvotes: 3
Reputation: 2334
With the Facebook Graph API, you can get Facebook data for text mining.
You cannot search for posts using the Facebook search bar
But the Graph API supports searching for the following types of objects:
All public posts: https://graph.facebook.com/search?q=watermelon&type=post
People: https://graph.facebook.com/search?q=mark&type=user
Pages: https://graph.facebook.com/search?q=platform&type=page
Events: https://graph.facebook.com/search?q=conference&type=event
Groups: https://graph.facebook.com/search?q=programming&type=group
Places: https://graph.facebook.com/search?q=coffee&type=place
Checkins: https://graph.facebook.com/search?type=checkin
Objects with location
I would highly recommend JavaScript, PHP or other languages mentioned in this document for getting the data and then using R for text mining since R has great tools for text mining
If you still prefer to go with R for the mining, you can connect to Facebook using RCurl and rjson and get the pages using getURL() command and write a small parser to parse the data using simple Regex.
Source: Did the same thing during an internship
Upvotes: 1
Reputation: 75
if you want easy access, you can also consider using twitter. the twitteR packages provides easy access to public accounts! plus there are some hands-on text mining applications for twitter online, see for example: http://jeffreybreen.wordpress.com/2011/07/04/twitter-text-mining-r-slides/
Upvotes: 0
Reputation: 7469
Why even worry about using the API at all? You can use a feature in Facebook to download all your data and it comes as a zipped file with HTML as the main data store. From there, you can grep and mine to your hearts content and you will be able to learn much more about R than jumping in headfirst with APIs.
Upvotes: 2