Facebook and R
Revision as of 15:22, 9 August 2016 by PeterHarding (talk | contribs)
Also see - Getting Started with R
install.packages("Rfacebook") # from CRAN library(devtools) install_github("Rfacebook", "pablobarbera", subdir = "Rfacebook") # from GitHub
library(Rfacebook) # token generated here: https://developers.facebook.com/tools/explorer token <- "XXXXXXXXXXXXXX" me <- getUsers("xxxx", token, private_info = TRUE) me$name # my name
my_friends <- getFriends(token, simplify = TRUE) head(my_friends$id, n = 1) # get lowest user ID
my_friends_info <- getUsers(my_friends$id, token, private_info = TRUE) table(my_friends_info$gender) # gender
table(substr(my_friends_info$locale, 1, 2)) # language table(substr(my_friends_info$locale, 4, 5)) # country table(my_friends_info$relationship_status)["It's complicated"] # relationship status
mat <- getNetwork(token, format = "adj.matrix") dim(mat)
See - http://blog.revolutionanalytics.com/2013/11/how-to-analyze-you-facebook-friends-network-with-r.html