Chapter 7 Abstracts

Fetching abstracts likely will come after searching for articles with ft_search(). There are a few scenarios in which simply getting abstracts in lieu of full text may be enough.

For example, if you know that a large portion of the articles you want to mine text from are closed access and you don’t have access to them, you may have access to the abstracts depending on the publisher.

In addition, there are cases in which you really only need abstracts regardless of whether full text is available or not.

ft_abstract() gives you access to the following data sources:

  • crossref
  • microsoft
  • plos
  • scopus
  • semanticscholar

7.1 Usage

library(fulltext)

List data sources available

ft_abstract_ls()
#> [1] "crossref"        "microsoft"       "plos"            "scopus"         
#> [5] "semanticscholar"

Search - by default searches against PLOS (Public Library of Science)

res <- ft_search(query = "ecology")
(dois <- res$plos$data$id)
#>  [1] "10.1371/journal.pone.0001248" "10.1371/journal.pone.0248090"
#>  [3] "10.1371/journal.pone.0059813" "10.1371/journal.pone.0080763"
#>  [5] "10.1371/journal.pone.0246749" "10.1371/journal.pone.0254411"
#>  [7] "10.1371/journal.pone.0220747" "10.1371/journal.pone.0155019"
#>  [9] "10.1371/journal.pone.0175014" "10.1371/journal.pone.0241618"

Take the output of ft_search() and pass directly to ft_abstract():

out <- ft_abstract(dois)
out
#> <fulltext abstracts>
#> Found:
#>   [Crossref: 4; Scopus: 0; Microsoft: 0; PLOS: 0; Semantic Scholar: 0]

The output has slots for each data source:

names(out)
#> [1] "crossref"        "plos"            "scopus"          "ma"             
#> [5] "semanticscholar"

Index to the data source you want to get data from, here selecting the first item:

out$plos[[1]]
#> $doi
#> [1] "10.1371/journal.pone.0001248"
#> 
#> $abstract
#> [1] ""

Which gives a named list, with the DOI as the first element, then the abstract as a single character string.

You can then take these abstracts and use any number of R packages for text mining.

7.2 By Ids

Instead of using ft_search() first, and passing those results to ft_abstract(), you can pass article ids (character/numeric) to ft_abstract().

Here, we’ll fetch abstracts for three articles from arXiv. With Semantic Scholar we need to prefix the string arXiv to the ids (if you use DOIs you don’t need to prefix any string).

arxiv_ids <- c("0710.3491", "0804.0713", "0810.4821", "1003.0315")
out <- ft_abstract(x = paste0("arXiv:", arxiv_ids), from = "semanticscholar")
unname(vapply(out$semanticscholar, "[[", "", "abstract"))

7.3 Abstracts options

All data sources for ft_abstract() accept configuration options as a named list. For example, if you set from="plos" you can set additional PLOS specfiic options by passing a named list to plosopts. You can find out what PLOS options are available by looking at the documention for ?rplos::searchplos.

The only data source that doesn’t allow configuration options is Semantic Scholar.

As all functions in fulltext, you can pass on curl options to each function call or set them globally for the session, see the curl options chapter.