Description Usage Arguments Details Value Examples
A function to get the URLs shares from CrowdTangle
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
)
|
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 |
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
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
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.