# NOT RUN {
## See examples for fbOAuth to know how token was created.
load("fb_oauth")
## Getting information about two example Facebook Pages
fb.pages <- FacebookPagesCollection(id = c("9thcirclegames",
"NathanNeverSergioBonelliEditore"),
token = fb_oauth)
## Pull the latest 10 posts from each page in a pages collection
fb.posts <- FacebookPostscollection(id = fb.pages, token = fb_oauth, n = 10)
## Pull all the likes from each element of the posts collection
fb.posts.likes <- FacebookLikesCollection(fb.posts, fb_token, n = Inf)
## Pull all the available comments from each post of the post collection
fb.comments <- FacebookPostscollection(id = fb.posts, token = fb_oauth, n = Inf)
## Pull all the likes from each element of the comments collections
fb.comments.likes <- FacebookLikesCollection(id = fb.comments, token = fb_oauth, n = Inf)
## Convert the collection to a data frame
fb.posts.likes.df <- as.data.frame(fb.posts.likes)
# The same as before in a more compact fashion using the pipe operator
# chaining from a Pages then to a Posts Collection and finally building a Likes Collection
fb.posts.likes.pipe <-
FacebookPagesCollection(id = c("9thcirclegames",
"NathanNeverSergioBonelliEditore"),
token = fb_oauth) %>%
FacebookPostscollection(n = 10) %>%
FacebookLikesCollection(n = Inf)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab