Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


SocialMediaLab (version 0.23.2)

importData: Import SocialMediaLab data previously saved to disk using the `Collect()` function.

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

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

See Also

Collect

Examples

Run this code

## 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")
## ---------------------------------------------

Run the code above in your browser using DataLab