Description Usage Arguments Details Value Note Author(s) See Also Examples
View source: R/CollectDataInstagram.R
Collect data from Instagram for generating different types of networks
1 2 | CollectDataInstagram(tag, n, lat, lng, distance, folder, mindate, maxdate,
verbose, sleep, writeToFile, waitForRateLimit, credential = NULL)
|
tag |
character string. Hashtag used to filter media. It is only possible for a single hashtag. |
n |
numeric. Maximum number of media to return. |
lat |
numeric. Latitude of the center search coordinate. |
lng |
numeric. Longitude of the center search coordinate. |
distance |
numeric. Default is 1km (distance=1000), max distance is 5km. |
folder |
character string. If different than |
mindate |
character string. Minimum date for search period. |
maxdate |
character string. Maximum date for search period. |
verbose |
logical. If |
sleep |
numeric, Number of seconds between API calls (default is 0). |
writeToFile |
logical. If |
waitForRateLimit |
logical. If |
credential |
Optional, a |
This function collects data from Instagram using either hashtag (e.g.
#obama) or search coordinates (latitude and longitude), and structures the
data into a data frame of class dataSource.Instagram
, ready for
creating networks for further analysis. This function draws heavily on the
‘searchInstagram' function (from the ’instaR' package) and includes all the
arguments for collecting Instagram data using that function, as well as
additional arguments listed below.
CollectDataInstagram
collects public pictures and videos from
Instagram, and also collects the maximum amount of comments and 'likes' for
each post. It draws on and extends the 'searchInstagram' function from the
'instaR' package.
As the 'instaR' documentation describes, it is only possible to apply one filter at a time: either search by hashtag OR search by coordinates. The 'mindate' and 'maxdata' search parameters only work when searching by location, not when searching by tag.
After the data are collected, the function finds and maps the relationships
between users and posts, and structures these relationships into a format
suitable for creating bimodal networks using CreateBimodalNetwork
.
A data frame object of class dataSource.Instagram
that can be
used with CreateBimodalNetwork
.
The current implementation only supports creating bimodal networks. Other network types will be added in the near future.
- bimodal networks; CreateBimodalNetwork
A bimodal (or two-mode) network means that there are two types of vertices present in the network (i.e. Instagram users and Instagram posts), with edges representing user i 'commenting' or 'liking' post j.
Timothy Graham <timothy.graham3@uq.net.au> & Robert Ackland <robert.ackland@anu.edu.au>
AuthenticateWithInstagramAPI
must be run first or no data
can be collected through the API.
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 26 27 28 29 30 31 32 33 34 35 36 | ## Not run:
## Use your own values for myAppID and myAppSecret
myAppID <- "123456789098765"
myAppSecret <- "abc123abc123abc123abc123abc123ab"
# Authenticate with the Instagram API using `AuthenticateWithInstagramAPI`
instagram_oauth_token <- AuthenticateWithInstagramAPI(appID=app_id, appSecret=app_secret,
useCachedToken=TRUE)
# EXAMPLE 1
# Run the `CollectDataInstagram` function and store the results in variable `myInstagramData`
# (searching by hashtag)
myInstagramData <- CollectDataInstagram(tag="obama", distance=5000, n=100, folder=NULL,
verbose=TRUE, waitForRateLimit=TRUE)
# Create a 'bimodal' network using \code{CreateBimodalNetwork}
g_bimodal_instagram_obama <- CreateBimodalNetwork(myInstagramData,writeToFile=F)
# View descriptive information about the bimodal network
g_bimodal_instagram_obama
# EXAMPLE 2
# Run the `CollectDataInstagram` function and store the results in variable `myInstagramData`
# (searching by coordinates in Brisbane (Australia) with a radius of 5km)
myInstagramData <- CollectDataInstagram(lat=-27.4701, lng=153.0220, distance=5000, n=100,
folder=NULL, verbose=TRUE, waitForRateLimit=TRUE)
# Create a 'bimodal' network using \code{CreateBimodalNetwork}
g_bimodal_instagram_brisbane <- CreateBimodalNetwork(myInstagramData,writeToFile=F)
# View descriptive information about the bimodal network
g_bimodal_instagram_brisbane
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.