Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow multiple DOIs for cr_abstract - or fail more gracefully #252

Open
@LukasWallrich

Description

@LukasWallrich

Could cr_abstract accept multiple DOI - like most functions in the package?

If not, a clearer error message would help:

library(rcrossref)cr_abstract(cr_r(2))#> Error in exists(z, private$crul_h_pool): first argument has length > 1

With some digging, I realised that I can already usecr_works for that, which is much faster than looping over cr_abstract. Is there an advantage to the current cr_abstract implementation? Or could it just be a wrapper for cr_works?

library(rcrossref)#Using cr_abstractmany_abstracts1<-function(dois) {  lapply(dois,function(doi) {res<- try(cr_abstract(doi),silent=TRUE)if (inherits(res,"try-error")) {return(NA_character_)    }else {return(res)    }  })}#Using cr_worksmany_abstracts2<-function(dois) {filt<-stats::setNames(dois, rep("doi", length(dois)))res<-rcrossref::cr_works(filter=filt,select= c("DOI","abstract"),limit= length(dois)  )res$data$abstract  }my_dois<- cr_r(100)system.time(abs1<- many_abstracts1(my_dois))#>    user  system elapsed#>   0.411   0.076  13.175sum(is.na(abs1))#> [1] 75system.time(abs2<- many_abstracts2(my_dois))#>    user  system elapsed#>   0.050   0.000   0.191sum(is.na(abs2))#> [1] 74

Created on 2025-10-02 withreprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp