Skip to content

Commit

Permalink
Merge pull request #35 from ropensci/cran_fix
Browse files Browse the repository at this point in the history
Cran fix
  • Loading branch information
njahn82 authored Sep 26, 2024
2 parents 531ec3c + 7d2c44b commit fcadcf7
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 104 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
pull_request:
branches: [main, master]

name: R-CMD-check
name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
Expand All @@ -18,7 +20,7 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
Expand All @@ -29,7 +31,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

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

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

Expand All @@ -45,3 +47,6 @@ jobs:
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Package: roadoi
Type: Package
Title: Find Free Versions of Scholarly Publications via Unpaywall
Version: 0.7.2
Version: 0.7.3
Authors@R: c(
person("Najko", "Jahn", role = c("aut", "cre"), email = "[email protected]"),
person("Tuija", "Sonkkila", role = c("rev"), comment = c("Tuija Sonkkila
reviewed the package for rOpenSci,
see https://github.com/ropensci/onboarding/issues/115", ORCID = "0000-0002-6892-9305")),
person("Ross Mounce", role = c("rev"), comment = c("Ross Mounce
person("Ross", "Mounce", role = c("rev"), comment = c("Ross Mounce
reviewed the package for rOpenSci,
see https://github.com/ropensci/onboarding/issues/115", ORCID = "0000-0002-3520-2046")),
person("Anne", "Hobert", role = c("ctb"), comment = c(ORCID = "0000-0003-2429-2995")),
Expand Down Expand Up @@ -39,5 +39,7 @@ Suggests:
covr,
rmarkdown,
lintr
RoxygenNote: 7.1.1
RoxygenNote: 7.3.2
VignetteBuilder: knitr
Encoding: UTF-8

7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## roadoi 0.7.3

Minor fixes:

- Fix CRAN check issue
- Update internal dependencies

## roadoi 0.7

New features:
Expand Down
18 changes: 9 additions & 9 deletions R/oadoi_fetch.r
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
#' name and author role \code{sequence}), if available. \cr
#' }
#'
#' The columns \code{best_oa_location}. \code{oa_locations} and
#' \code{oa_locations_embargoed} are list-columns that contain
#' useful metadata about the OA sources found by Unpaywall.
#'
#' The columns \code{best_oa_location}. \code{oa_locations} and
#' \code{oa_locations_embargoed} are list-columns that contain
#' useful metadata about the OA sources found by Unpaywall.
#'
#' If \code{.flatten = TRUE} the list-column \code{oa_locations} will be
#' restructured in a long format where each OA fulltext is represented by
#' one row.
Expand Down Expand Up @@ -151,11 +151,11 @@ oadoi_fetch <-
if(.flatten == TRUE){
out <- req %>%
dplyr::select(
-.data$best_oa_location,
-.data$authors,
-.data$oa_locations_embargoed
-"best_oa_location",
-"authors",
-"oa_locations_embargoed"
) %>%
tidyr::unnest(.data$oa_locations, keep_empty = TRUE)
tidyr::unnest("oa_locations", keep_empty = TRUE)
} else {
out <- req
}
Expand Down Expand Up @@ -187,7 +187,7 @@ oadoi_fetch_ <- function(doi = NULL, email = NULL) {
u <- httr::modify_url(
oadoi_baseurl(),
query = list(email = email),
path = c(oadoi_api_version(),
path = c(oadoi_api_version(),
gsub("[[:space:]]", "", doi))
)
# Call Unpaywall Data API
Expand Down
4 changes: 2 additions & 2 deletions R/roadoi-package.r
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
#' @name roadoi-package
#' @aliases roadoi
#' @docType package
#' @keywords package
NULL
#' @keywords internal
"_PACKAGE"
3 changes: 1 addition & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ knitr::opts_chunk$set(
)
```

[![R build status](https://github.com/ropensci/roadoi/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/roadoi/actions)
[![codecov.io](https://codecov.io/github/ropensci/roadoi/coverage.svg?branch=master)](https://codecov.io/github/ropensci/roadoi?branch=master)
[![R build](https://github.com/ropensci/roadoi/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/roadoi/actions)
[![cran version](http://www.r-pkg.org/badges/version/roadoi)](https://cran.r-project.org/package=roadoi)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/roadoi)](https://github.com/r-hub/cranlogs.app)
[![review](https://badges.ropensci.org/115_status.svg)](https://github.com/ropensci/software-review/issues/115)
Expand Down
76 changes: 32 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,62 @@

# roadoi - Use Unpaywall with R

[![R build
status](https://github.com/ropensci/roadoi/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/roadoi/actions)
[![codecov.io](https://codecov.io/github/ropensci/roadoi/coverage.svg?branch=master)](https://codecov.io/github/ropensci/roadoi?branch=master)
[![cran
version](http://www.r-pkg.org/badges/version/roadoi)](https://cran.r-project.org/package=roadoi)
[![rstudio mirror
downloads](http://cranlogs.r-pkg.org/badges/roadoi)](https://github.com/r-hub/cranlogs.app)


[![R build](https://github.com/ropensci/roadoi/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/roadoi/actions)
[![cran version](http://www.r-pkg.org/badges/version/roadoi)](https://cran.r-project.org/package=roadoi)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/roadoi)](https://github.com/r-hub/cranlogs.app)
[![review](https://badges.ropensci.org/115_status.svg)](https://github.com/ropensci/software-review/issues/115)

roadoi interacts with the [Unpaywall REST
API](https://unpaywall.org/products/api), an openly available
web-interface which returns metadata about open access versions of
scholarly works.


roadoi interacts with the [Unpaywall REST API](https://unpaywall.org/products/api),
an openly available web-interface which returns metadata about open access versions of scholarly works.

This client supports the most recent API Version 2.

API Documentation: <https://unpaywall.org/products/api>

## How do I use it?
## How do I use it?

Use the `oadoi_fetch()` function in this package to get open access status
information and full-text links from Unpaywall.


Use the `oadoi_fetch()` function in this package to get open access
status information and full-text links from Unpaywall.

``` r
roadoi::oadoi_fetch(dois = c("10.1038/ng.3260", "10.1093/nar/gkr1047"),
email = "[email protected]")
#> # A tibble: 2 x 21
#> doi best_oa_location oa_locations oa_locations_emb…
#> <chr> <list> <list> <list>
#> 1 10.1038… <tibble [1 × 11]> <tibble [1 … <tibble [0 × 0]>
#> 2 10.1093… <tibble [1 × 10]> <tibble [6 … <tibble [0 × 0]>
#> # … with 17 more variables: data_standard <int>,
#> # is_oa <lgl>, is_paratext <lgl>, genre <chr>,
#> # oa_status <chr>, has_repository_copy <lgl>,
#> # journal_is_oa <lgl>, journal_is_in_doaj <lgl>,
#> # journal_issns <chr>, journal_issn_l <chr>,
#> # journal_name <chr>, publisher <chr>,
#> # published_date <chr>, year <chr>, title <chr>,
#> # updated_resource <chr>, authors <list>
#> # A tibble: 2 × 21
#> doi best_oa_location oa_locations oa_locations_embargoed data_standard is_oa
#> <chr> <list> <list> <list> <int> <lgl>
#> 1 10.1038/ng.3260 <tibble [0 × 0]> <tibble> <tibble [0 × 0]> 2 FALSE
#> 2 10.1093/nar/gkr… <tibble> <tibble> <tibble [0 × 0]> 2 TRUE
#> # ℹ 15 more variables: is_paratext <lgl>, genre <chr>, oa_status <chr>,
#> # has_repository_copy <lgl>, journal_is_oa <lgl>, journal_is_in_doaj <lgl>,
#> # journal_issns <chr>, journal_issn_l <chr>, journal_name <chr>, publisher <chr>,
#> # published_date <chr>, year <chr>, title <chr>, updated_resource <chr>, authors <list>
```

There are no API restrictions. However, providing an email address is
required and a rate limit of 100k is suggested. If you need to access
more data, use the [data dump](https://unpaywall.org/products/snapshot)
instead.
There are no API restrictions. However, providing an email address is required and a rate limit of 100k is suggested. If you need to access more data, use the [data dump](https://unpaywall.org/products/snapshot) instead.

### RStudio Addin

This package also has a RStudio Addin for easily finding free full-texts
in RStudio.
This package also has a RStudio Addin for easily finding free full-texts in RStudio.

![](man/figures/oadoi_addin.gif)

## How do I get it?
## How do I get it?

Install and load from [CRAN](https://cran.r-project.org/package=roadoi):


``` r
install.packages("roadoi")
library(roadoi)
```

To install the development version, use the [devtools
package](https://cran.r-project.org/package=devtools)
To install the development version, use the [devtools package](https://cran.r-project.org/package=devtools)


``` r
devtools::install_github("ropensci/roadoi")
Expand All @@ -77,14 +69,10 @@ See <https://docs.ropensci.org/roadoi/> to get started.

## Meta

Please note that this project is released with a [Contributor Code of
Conduct](https://github.com/ropensci/roadoi/blob/master/CONDUCT.md). By
participating in this project you agree to abide by its terms.
Please note that this project is released with a [Contributor Code of Conduct](https://github.com/ropensci/roadoi/blob/master/CONDUCT.md). By participating in this project you agree to abide by its terms.

License: MIT

Please use the [issue
tracker](https://github.com/ropensci/roadoi/issues) for bug reporting
and feature requests.
Please use the [issue tracker](https://github.com/ropensci/roadoi/issues) for bug reporting and feature requests.

[![ropensci\_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org)
[![ropensci_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org)
6 changes: 3 additions & 3 deletions man/oadoi_fetch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 22 additions & 1 deletion man/roadoi-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test_oadoi_fetch.r
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test_that("oadoi_fetch returns", {


# some character matches
expect_match(h$oa_status, "bronze")
expect_match(h$oa_status, "closed")
expect_match(h$journal_issn_l, "0001-8708")
expect_match(a$published_date, "2016-08-09")

Expand Down Expand Up @@ -91,7 +91,7 @@ test_that("oadoi_fetch removes all types of whitespace", {
skip_on_cran()
dois <- c("10.1177/ 0042098012452322",
"10.1038/ng.3260 ",
" 10. 7717/peerj.2323
" 10. 7717/peerj.2323
")
a <- expect_message(
oadoi_fetch(dois, email = "[email protected]")
Expand Down
Loading

0 comments on commit fcadcf7

Please sign in to comment.