Description Usage Arguments Details Value Note Author(s) See Also Examples
View source: R/CollectDataFacebook.R
Collect data from Facebook pages for generating different types of networks
1 2 | CollectDataFacebook(pageName, rangeFrom, rangeTo, verbose, n, writeToFile,
credential = NULL)
|
pageName |
character string, specifying the name of the Facebook page.
For example, if page is: https://www.facebook.com/StarWars, then
|
rangeFrom |
character string, specifying a 'start date' for data
collection, in the format YYYY-MM-DD. For example, to collect data starting
from July 4th 2015, |
rangeTo |
character string, specifying an 'end date' for data
collection, in the format YYYY-MM-DD. For example, to collect data until
December 25th 2015, |
verbose |
logical. If |
n |
numeric, maximum number of comments and likes to return (see
|
writeToFile |
logical. If |
credential |
Optional, a |
This function collects data from Facebook pages (i.e. post data and
comments/likes data within posts), and structures the data into a data frame
of class dataSource.facebook
, ready for creating networks for further
analysis.
CollectDataFacebook
collects public 'post' data from a given Facebook
page, including comments and 'likes' from within each post.
The function then finds and maps the edgeTypes between users and posts,
and structures these relationships into a format suitable for creating
bimodal networks using CreateBimodalNetwork
.
A date range must be specified for collecting post data using
rangeFrom
and rangeTo
(i.e. data will be collected from posts
posted within the date range). If no date range is supplied, then the
default is the current system date minus one week (i.e. 7 days leading up to
current system date).
A data frame object of class dataSource.facebook
that can be
used with Create
.
Currently supported network types:
- bimodal networks - dynamic networks
Note: dynamic networks created using Facebook data are bimodal. This means that there are two types of vertices present in the network (i.e. Facebook users and Facebook posts), with edges representing the time(s) when user i commented on post j. Currently, timestamp data is not available through the Facebook API for 'likes' data (i.e. when user i 'likes' post j), so edge ties based on 'likes' are excluded from dynamic Facebook data.
Timothy Graham <timothy.graham3@uq.net.au> & Robert Ackland <robert.ackland@anu.edu.au>
Authenticate
must be run first or no data
will be collected.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
## Use your own values for myAppID and myAppSecret
appID <- "xxxx"
appSecret <- "yyyy"
## Collect data and create bimodal network
g_bimodal_facebook_star_wars <- Authenticate("Facebook",
appID = appID, appSecret = appSecret) %>%
SaveCredential("FBCredential.RDS") %>%
Collect(pageName="StarWars", rangeFrom="2015-03-01",
rangeTo="2015-03-02", writeToFile=FALSE) %>%
Create("Bimodal")
## Create a dynamic network using the saved credentials
g_bimodal_facebook_star_wars_dynamic <-
LoadCredential("FBCredential.RDS") %>%
Collect(pageName="StarWars", rangeFrom="2015-03-01",
rangeTo="2015-03-02", writeToFile=FALSE) %>%
Create("dynamic")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.