CollectDataFacebook: Note: this function is DEPRECATED and will be removed in a...

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/CollectDataFacebook.R

Description

Collect data from Facebook pages for generating different types of networks

Usage

1
2
CollectDataFacebook(pageName, rangeFrom, rangeTo, verbose, n, writeToFile,
  credential = NULL)

Arguments

pageName

character string, specifying the name of the Facebook page. For example, if page is: https://www.facebook.com/StarWars, then pageName="StarWars".

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, rangeFrom would be "2015-07-04". Default value is current system date minus one week (i.e. the date 7 days ago).

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, rangeFrom would be "2015-12-25". Default value is the current system date.

verbose

logical. If TRUE then this function will output runtime information to the console as it computes. Useful diagnostic tool for long computations. Default is FALSE.

n

numeric, maximum number of comments and likes to return (see getPost in Rfacebook package). Default value is 1000.

writeToFile

logical. If TRUE then the data is saved to file in current working directory (CSV format), with filename denoting rangeFrom, rangeTo, and pageName.

credential

Optional, a credential object created by Authenticate.

Details

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).

Value

A data frame object of class dataSource.facebook that can be used with Create.

Note

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.

Author(s)

Timothy Graham <timothy.graham3@uq.net.au> & Robert Ackland <robert.ackland@anu.edu.au>

See Also

Authenticate must be run first or no data will be collected.

Examples

 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)

SocialMediaLab documentation built on May 29, 2017, 9:41 p.m.