forked from JulianHill/R-Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathr_rfacebook.r
More file actions
29 lines (17 loc) · 780 Bytes
/
r_rfacebook.r
File metadata and controls
29 lines (17 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
fbOAuth(app_id, app_secret, extended_permissions = TRUE)
require("Rfacebook")
fb_oauth <- fbOAuth(app_id="123456789", app_secret="1A2B3C4D")
#now we have our fb_oauth connection
#we will just save them to be able to use them later
save(fb_oauth, file="fb_oauth“)
#so if you want to connect to Facebook again you just have to call
load("fb_oauth")
#the getUsers function return public information about one or more Facebook user
me <- getUsers("me", token=fb_oauth)
getFriends(token, simplify = FALSE)
my_friends <- getFriends(token=fb_oauth, simplify=TRUE)
head(my_friends, n=10)
getUser()
my_friends_info <- getUsers(my_friends$id, token=fb_oauth, private_info=TRUE)
#create a table with the relationship statuses
table(my_friends_info$relationship_status)