Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/R-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Description: Client for various 'CrossRef' 'APIs', including 'metadata' search
(including 'bibtex', 'citeproc-json', 'rdf-xml', etc.), convert 'DOIs'
to 'PMIDs', and 'vice versa', get citations for 'DOIs', and get links to
full text of articles when available.
Version: 1.2.009
Version: 1.2.1
License: MIT + file LICENSE
Authors@R: c(
person("Scott", "Chamberlain", role = "aut"),
Expand Down
3 changes: 1 addition & 2 deletions R/cr_cn.r
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ parse_bibtex <- function(x) {
chk4pk("bibtex")
x <- gsub("@[Dd]ata", "@Misc", x)
writeLines(x, "tmpscratch.bib")
out <- bibtex::do_read_bib("tmpscratch.bib",
srcfile = srcfile("tmpscratch.bib"))
out <- bibtex::do_read_bib("tmpscratch.bib")
unlink("tmpscratch.bib")
if (length(out) > 0) {
out <- out[[1]]
Expand Down
7 changes: 7 additions & 0 deletions R/cr_works.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
#' cr_works(dois='10.1007/12080.1874-1746')
#' cr_works(dois=c('10.1007/12080.1874-1746','10.1007/10452.1573-5125',
#' '10.1111/(issn)1442-9993'))
#' # You can also use filter to get metatdata for several dois at once.
#' # This is much faster than querying each doi individually.
#' my_dois <- c('10.1007/s11192-025-05390-3', '10.1162/qss_a_00348',
#' '10.1007/10452.1573-5125')
#' # Prepare filter
#' names(my_dois) <- rep("doi", length(my_dois))
#' cr_works(filter = my_dois, limit = length(my_dois))
#'
#' # progress bar
#' cr_works(dois=c('10.1007/12080.1874-1746','10.1007/10452.1573-5125'),
Expand Down
549 changes: 549 additions & 0 deletions tests/fixtures/cr_works_doi_filter.yml

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions tests/testthat/test-cr_works.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,19 @@ test_that("cr_works fails well: arguments that dont require http requests", {
expect_error(cr_works(async = 5), "is not TRUE")
})

test_that("cr_works - works with doi filter", {

vcr::use_cassette("cr_works_doi_filter", {
dois <- c('10.1007/s11192-025-05390-3', '10.1162/qss_a_00348', '10.1007/10452.1573-5125')
names(dois) <- rep("doi", length(dois))
res <- cr_works(filter = dois, limit = length(dois))
expect_is(res, "list")
expect_is(res$data, "data.frame")
expect_equal(nrow(res$data), length(dois))
expect_true(all(res$data$doi %in% dois))
})
})

# see https://github.com/ropensci/rcrossref/issues/211
test_that("content domain parsing fix", {
# this DOI caused a failure in parsing content domain
Expand Down