Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch functionality for ScopusAPI code #4

Open
kelloggresearchgroup opened this issue Apr 18, 2023 · 2 comments
Open

Batch functionality for ScopusAPI code #4

kelloggresearchgroup opened this issue Apr 18, 2023 · 2 comments

Comments

@kelloggresearchgroup
Copy link

Good afternoon. I was wondering how simple it would be to use a list of strings to search, one by one, using this script? Could I enter a .csv file with my search terms, one per line, and then have it run the script for each line and report out the data one at a time? Do you have any other suggestions how to automate it like that? Thanks!

@christopherBelter
Copy link
Owner

You could probably lapply() the searchByString() function over the search strings in your .csv file to do something like that. So do something like

my_results <- lapply(1:nrow(my_csv), function(x) searchByString(my_csv$terms[x], outfile = paste0("my_results_", x, ".xml"))).

The result will be a list of XML files, one for each search string. So then do

my_data <- lapply(my_results, extractXML)
my_data <- do.call(rbind, my_data)

to extract the files into data frames and then (if you want) merge all the results back together. I'm freetyping the code here, so there might be typos, but something like that should work.

@kelloggresearchgroup
Copy link
Author

Thanks, I'll give that a try. Appreciate the insight!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants