importData: Import SocialMediaLab data previously saved to disk using the...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/importData.R

Description

This function imports social media data previously collected and saved to disk using the 'Collect()' function in SocialMediaLab. Using this function to import data ensures that the correct classes are applied to the dataframe, in order for SocialMediaLab to know how to handle it (e.g. creating different types of networks using the 'Create' function).

Usage

1
importData(file, dataSource)

Arguments

file

character, specifying the file path to the data to be imported

dataSource

character, the type of social media. Currently supports "facebook", "twitter", "youtube", and "instagram" (not case sensitive).

Value

A dataframe with specific class attributes for SocialMediaLab functionality

Author(s)

Timothy Graham <timothy.graham3@uq.net.au>

See Also

Collect

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
require(magrittr)
## Facebook example

# Specify your API keys
appID <- "xxxx"
appSecret <- "xxxx"

# Authenticate and Collect some data (and save data to disk using `writeToFile=TRUE`)
myFacebookData <- Authenticate("Facebook", appID = appID, appSecret = appSecret) %>%
   Collect(pageName="StarWars", rangeFrom="2015-03-01",
     rangeTo="2015-03-02", writeToFile=TRUE)

# Import the data (that was saved to disk in the previous step)
myStarWarsData <- importData("2015-03-01_to_2015-03-02_StarWars_FacebookData.csv","facebook")

# Create a network using the imported dataframe object
myNetwork <- myStarWarsData %>% Create("Bimodal")

## End(Not run)

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