get_ctshares: get_ctshares

Description Usage Arguments Details Value Examples

View source: R/get_ctshares.R

Description

A function to get the URLs shares from CrowdTangle

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
get_ctshares(
  urls,
  url_column,
  date_column,
  platforms = "facebook,instagram",
  nmax = 1000,
  sleep_time = 30,
  clean_urls = FALSE,
  save_ctapi_output = FALSE
)

Arguments

urls

a dataframe with at least a column "url" containing the URLs, and a column "date" with their published date

url_column

name of the column (placed inside quote marks) where the URLs are stored (defaults to "url")

date_column

name of the column (placed inside quote marks) where the date of the URLs are stored (defaults to "date")

platforms

default to "facebook,instagram". You can specify only "facebook" to search on Facebook, or only "instagram" to search on Instagram

nmax

max number of results for query (default 1000 as per

sleep_time

pause between queries to respect API rate limits. Default to 30 secs, it can be lowered or increased depending on the assigned API rate limit.

clean_urls

clean the URLs from tracking parameters (default FALSE)

save_ctapi_output

saves the original CT API output in ./rawdata/ct_shares.df.0.rds

Details

to start using the library you need to set the CrowdTangle API key. Open the environment variable file with file.edit("~/.Renviron"), write CROWDTANGLE_API_KEY = <YOUR_API_KEY>, save the file and restart your current R session to start using the CrowdTangle API

Value

a data.frame of posts that shared the URLs and a number of variables returned by the CrowdTangle API links endpoint and the original data set of news

Examples

1
  df <- get_ctshares(urls, url_column=“url”, date_column=“date”, platforms="facebook,instagram", nmax=100, sleep_time=30, clean_urls=FALSE, save_ctapi_output=FALSE)

LeonardoSaracino/CooRnet_projectSNA documentation built on Dec. 18, 2021, 4:33 a.m.