Description Usage Arguments Details Value Nesting fields Valid sources Author(s) See Also Examples
View source: R/FacebookLikesCollection.R
Connect to Facebook Graph API, get information from a list of likes to public posts or comments and build a FacebookLikesCollection-class
instance.
1 2 3 4 |
id |
A character vector or a comma-delimited string of IDs or an existing Facebook Collection of any of the supported types (see below). |
token |
Either a temporary access token created at
https://developers.facebook.com/tools/explorer or the OAuth token
created with |
parameters |
A list of parameters to be added to the Facebook Graph API query. For more information on the accepted parameters, see: https://developers.facebook.com/docs/graph-api/using-graph-api. |
fields |
A character vector with the fields to get for each |
n |
If |
metadata |
If set to |
.progress |
progress_bar object as defined in the plyr package.
By default the |
FacebookLikesCollection
is the constructor for the FacebookLikesCollection-class
.
It returns data about likes to posts or comments but doesn't return the comments or posts themselves.
Since Facebook doesn't provide a key for a single like, the ID slot for this kind of collection doesn't uniquely identify a like on Facebook.
The id
(the user who put the like) coupled with the parent
(the place where she put the like) identifies a unique key for the like.
As a consequence, you cannot build a likes collection starting from atomic IDs, but you must pass an instance of a Facebook Posts Collection or a Facebook Comments Collection built using the construction FacebookPostsCollection
or FacebookCommentsCollection
as id
parameter.
A collection of likes in a FacebookLikesCollection-class
object.
Due to the network-graph nature of Facebook data model,
you can specify fields details for each field nesting .fields()
clauses.
For example, if you need only id
and source
for the cover
field, this is valid among others:
cover.fields(id,source)
.
Following the same philosophy, if you need only id
and name
for the from
node
you can use from.fields(id,name)
.
Instead of a character vector, one of these collections can also be passed as parameter in id
:
FacebookPostsCollection-class
will build a collection with
all the likes to the posts of the source collection
FacebookCommentsCollection-class
will build a collection with
all the likes to the comments of the source collection
FacebookUsersCollection-class
will build a collection with
the posts written on the walls of the users in the source collection.
FacebookPhotosCollection-class
will build a collection with
the likes to the photos in the source collection. The author of the photo may grant the
user_photos
to the current application to perform this action.
FacebookVideosCollection-class
will build a collection with
the likes to the videos in the source collection. The author of the photo may grant the
user_videos
to the current application to perform this action.
Gabriele Baldassarre https://gabrielebaldassarre.com
FacebookCommentsCollection
,
FacebookPostsCollection
,
facebook.object.likes
,
fbOAuth
Other Facebook Collection Constructors: FacebookAlbumsCollection
,
FacebookCommentsCollection
,
FacebookConversationsCollection
,
FacebookEventsCollection
,
FacebookGroupsCollection
,
FacebookMessagesCollection
,
FacebookPagesCollection
,
FacebookPhotosCollection
,
FacebookPostsCollection
,
FacebookReactionsCollection
,
FacebookUsersCollection
,
FacebookVideosCollection
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 30 31 32 33 34 | ## 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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.