| Title: | Automatically Fetching References Metadata from Literature Databases |
|---|---|
| Description: | Provides functions to automatically retrieve and deduplicate reference metadata based on saved search strings. Access to Web of Science and Scopus requires personal API keys, while PubMed can be queried without one. The optional deduplication functionality requires the package 'ASySD' available from <https://github.com/camaradesuk/ASySD>. |
| Authors: | Thomas Dumond [cre, aut, cph] (ORCID: <https://orcid.org/0000-0002-9427-8649>), Charles Caraguel [ctb] (ORCID: <https://orcid.org/0000-0003-0019-4813>), Torben Nielsen [ctb] (ORCID: <https://orcid.org/0000-0002-8941-7376>) |
| Maintainer: | Thomas Dumond <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.2 |
| Built: | 2026-05-29 10:10:42 UTC |
| Source: | https://github.com/thomasdumond/litfetchr |
Creates a read-only Rscript and a task to run the code automatically at a specified frequency and time, to retrieve references corresponding to the saved search string(s) on up to three platforms (e.g. Web of Science, Scopus and PubMed).
auto_LitFetchR_setup( task_id = "task_id", when = "DAILY", time = "08:00", wos = FALSE, scp = FALSE, pmd = FALSE, directory, dedup = FALSE, open_file = FALSE, dry_run = FALSE )auto_LitFetchR_setup( task_id = "task_id", when = "DAILY", time = "08:00", wos = FALSE, scp = FALSE, pmd = FALSE, directory, dedup = FALSE, open_file = FALSE, dry_run = FALSE )
task_id |
Name of the automated reference retrieval task (e.g. one keyword describing your review). |
when |
Frequency of the automated reference retrieval task (DAILY, WEEKLY or MONTHLY). |
time |
Time of the automated reference retrieval task (must be HH:MM 24-hour clock format). |
wos |
Runs the search on Web of Science (TRUE or FALSE). |
scp |
Runs the search on Scopus (TRUE or FALSE). |
pmd |
Runs the search on PubMed (TRUE or FALSE). |
directory |
Choose the directory in which the search string is saved (Project's directory). That is also where the references metadata will be saved. |
dedup |
Deduplicates the retrieved references (TRUE or FALSE). |
open_file |
Automatically opens the CSV file after reference retrieval. |
dry_run |
Simulation run option. |
NULL (invisibly). Called for its side effects:
writes an R script and schedules a task (Windows Task Scheduler or cron)
to run the script automatically.
# This is a "dry run" example. # No task will actually be scheduled, # it only shows how the function should react. auto_LitFetchR_setup(task_id = "fish_vibrio", when = "WEEKLY", time = "14:00", wos = TRUE, scp = TRUE, pmd = TRUE, directory, dedup = FALSE, open_file = FALSE, dry_run = TRUE )# This is a "dry run" example. # No task will actually be scheduled, # it only shows how the function should react. auto_LitFetchR_setup(task_id = "fish_vibrio", when = "WEEKLY", time = "14:00", wos = TRUE, scp = TRUE, pmd = TRUE, directory, dedup = FALSE, open_file = FALSE, dry_run = TRUE )
An interactive function that ask the user to enter a search string and provide the number of results from 3 platforms: Web of Science, Scopus and PubMed. You can then save one or more search strings to retrieve the references later.
create_save_search( wos = FALSE, scp = FALSE, pmd = FALSE, directory, dry_run = FALSE )create_save_search( wos = FALSE, scp = FALSE, pmd = FALSE, directory, dry_run = FALSE )
wos |
Runs the search on Web of Science (TRUE or FALSE). |
scp |
Runs the search on Scopus (TRUE or FALSE). |
pmd |
Runs the search on PubMed (TRUE or FALSE). |
directory |
Choose the directory in which the search string and the search history will be saved. |
dry_run |
Simulation run option. |
NULL (invisibly). Called for its side effects:
interactive querying and writing search history files.
# This is a "dry run" example. # No search will be created and no database will be accessed. # It only shows how the function should react. create_save_search(wos = TRUE, scp = TRUE, pmd = TRUE, directory, dry_run = TRUE)# This is a "dry run" example. # No search will be created and no database will be accessed. # It only shows how the function should react. create_save_search(wos = TRUE, scp = TRUE, pmd = TRUE, directory, dry_run = TRUE)
Deduplicates the references from up to three dataframes.
dedup_refs( df1 = NULL, df2 = NULL, df3 = NULL, directory, open_file = FALSE, dry_run = FALSE )dedup_refs( df1 = NULL, df2 = NULL, df3 = NULL, directory, open_file = FALSE, dry_run = FALSE )
df1 |
Dataframe 1 (can be NULL) |
df2 |
Dataframe 2 (can be NULL) |
df3 |
Dataframe 3 (can be NULL) |
directory |
Choose the directory in which the references deduplication history will be saved. |
open_file |
Automatically opens the CSV file after reference retrieval. |
dry_run |
Simulation run option. |
NULL (invisibly). Called for its side effects:
writes a CSV of deduplicated citations and
an Excel workbook recording the deduplication history.
# This is a "dry run" example. # No deduplication will happen. # It only shows how the function should react. dedup_refs(df1 = df_vibrio_wos, df2 = df_vibrio_scp, df3 = df_vibrio_pmd, directory = tempdir(), open_file = FALSE, dry_run = TRUE )# This is a "dry run" example. # No deduplication will happen. # It only shows how the function should react. dedup_refs(df1 = df_vibrio_wos, df2 = df_vibrio_scp, df3 = df_vibrio_pmd, directory = tempdir(), open_file = FALSE, dry_run = TRUE )
Retrieves references corresponding to the saved search string(s) on up to three platforms (e.g. Web of Science, Scopus and PubMed).
manual_fetch( wos = FALSE, scp = FALSE, pmd = FALSE, directory, dedup = FALSE, open_file = FALSE, dry_run = FALSE )manual_fetch( wos = FALSE, scp = FALSE, pmd = FALSE, directory, dedup = FALSE, open_file = FALSE, dry_run = FALSE )
wos |
Runs the search on Web of Science (TRUE or FALSE). |
scp |
Runs the search on Scopus (TRUE or FALSE). |
pmd |
Runs the search on PubMed (TRUE or FALSE). |
directory |
Choose the directory in which the search string is saved (Project's directory). That is also where the references metadata will be saved. |
dedup |
Deduplicates the retrieved references (TRUE or FALSE). |
open_file |
Automatically opens the CSV file after reference retrieval. |
dry_run |
Simulation run option. |
NULL (invisibly). Called for its side effects: Create a CSV file with the references metadata, a history file of the references retrieved and a history file of the deduplication (if the option is selected).
# This is a "dry run" example. # No references will actually be scheduled, it only shows how the function should react. manual_fetch(wos = TRUE, scp = TRUE, pmd = TRUE, directory, dedup = TRUE, open_file = FALSE, dry_run = TRUE )# This is a "dry run" example. # No references will actually be scheduled, it only shows how the function should react. manual_fetch(wos = TRUE, scp = TRUE, pmd = TRUE, directory, dedup = TRUE, open_file = FALSE, dry_run = TRUE )
Removes a scheduled task using the "task_id" from Task Scheduler (Windows) or Cron (Mac/Linux).
remove_scheduled_task(task_id, dry_run = FALSE)remove_scheduled_task(task_id, dry_run = FALSE)
task_id |
Name/ID of the scheduled task (Windows Task Scheduler or Cron). |
dry_run |
Simulation run option. |
NULL (invisibly). Called for its side effects: removes a scheduled task saved using the function 'auto_LitFetchR_setup'.
# This is a "dry run" example. # No task will actually be removed, it only shows how the function should react. remove_scheduled_task("fish_vibrio", dry_run = TRUE )# This is a "dry run" example. # No task will actually be removed, it only shows how the function should react. remove_scheduled_task("fish_vibrio", dry_run = TRUE )
You can set wos_api_key, scp_api_key, or both at the same time. Remember to restart the R session after saving your API keys.
save_api_keys(wos_api_key = NULL, scp_api_key = NULL, dry_run = FALSE)save_api_keys(wos_api_key = NULL, scp_api_key = NULL, dry_run = FALSE)
wos_api_key |
The API key value for Web of Science (use quotation marks). |
scp_api_key |
The API key value for Scopus (use quotation marks). |
dry_run |
Simulation run option. |
Logical. TRUE if at least one value was written, FALSE if left unchanged.
save_api_keys(wos_api_key = "abcd01234", scp_api_key = "efgh5678", dry_run = TRUE )save_api_keys(wos_api_key = "abcd01234", scp_api_key = "efgh5678", dry_run = TRUE )