Description Usage Arguments Details Value Nesting fields Valid sources Author(s) See Also Examples
View source: R/FacebookPagesCollection.R
Connect to Facebook Graph API, get information from a list of public Facebook pages and build a FacebookPagesCollection-class
instance.
1 2 3 4 | FacebookPagesCollection(id, token = NULL, parameters = list(),
fields = c("id", "username", "name", "about", "category", "description",
"fan_count", "link", "talking_about_count"), metadata = FALSE,
.progress = create_progress_bar())
|
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 |
metadata |
If set to |
.progress |
progress_bar object as defined in the plyr package.
By default the |
FacebookPagesCollection
is the constructor for the FacebookPagesCollection-class
.
It returns data about pages but doesn't return lists of posts or the fanbase (although it will return a summary view for the latter).
A collection of pages in a FacebookPagesCollection-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
:
FacebookPagesCollection-class
will build a collection with
the same elements as the source collection.
FacebookMixedCollection-class
will build a collection with
only the page elements of the source collection.
Gabriele Baldassarre https://gabrielebaldassarre.com
FacebookPostsCollection
, FacebookCommentsCollection
, fbOAuth
Other Facebook Collection Constructors: FacebookAlbumsCollection
,
FacebookCommentsCollection
,
FacebookConversationsCollection
,
FacebookEventsCollection
,
FacebookGroupsCollection
,
FacebookLikesCollection
,
FacebookMessagesCollection
,
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 | ## Not run:
## See examples for fbOAuth to know how token was created.
load("fb_oauth")
## Getting information about 9th Circle Games' Facebook Page
fb.pages <- FacebookPagesCollection(id = c("9thcirclegames",
"NathanNeverSergioBonelliEditore"),
token = fb_oauth)
## Getting informations from the same pages, but with a different set of fields
fb.pages.covers <- FacebookPagesCollection(id = fb.pages,
fields = c("id",
"name",
"cover.fields(id,source,height,width)")
)
## Convert the collection to a data frame
fb.pages.df <- as.data.frame(fb.pages)
## Build a collection of the pages the current user likes
likes.pages <- FacebookUsersCollection("me", fb_token, fields = "") %>%
facebook.object.likes() %>%
FacebookPagesCollection()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.