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

Commit3c0ac37

Browse files
authored
Merge pull request#30 from ropensci/v0.7
V0.7
2 parents49e3281 +fa03626 commit3c0ac37

File tree

10 files changed

+189
-192
lines changed

10 files changed

+189
-192
lines changed

‎DESCRIPTION‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
Package: roadoi
22
Type: Package
33
Title: Find Free Versions of Scholarly Publications via Unpaywall
4-
Version: 0.6.09
4+
Version: 0.7
55
Authors@R: c(
66
person("Najko", "Jahn", role = c("aut", "cre"), email = "najko.jahn@gmail.com"),
77
person("Tuija", "Sonkkila", role = c("rev"), comment = c("Tuija Sonkkila
88
reviewed the package for rOpenSci,
99
see https://github.com/ropensci/onboarding/issues/115", ORCID = "0000-0002-6892-9305")),
1010
person("Ross Mounce", role = c("rev"), comment = c("Ross Mounce
1111
reviewed the package for rOpenSci,
12-
see https://github.com/ropensci/onboarding/issues/115", ORCID = "0000-0002-3520-2046"))
12+
see https://github.com/ropensci/onboarding/issues/115", ORCID = "0000-0002-3520-2046")),
13+
person("Anne", "Hobert", role = c("ctb"), comment = c(ORCID = "0000-0003-2429-2995")),
14+
person("Delwen", "Franzen", role = c("ctb"))
1315
)
1416
Description: This web client interfaces Unpaywall <https://unpaywall.org/products/api>, formerly
1517
oaDOI, a service finding free full-texts of academic papers by linking DOIs with
@@ -29,7 +31,8 @@ Imports:
2931
tibble,
3032
miniUI,
3133
shiny (>= 1.0.3),
32-
tidyr
34+
tidyr,
35+
rlang
3336
Suggests:
3437
roxygen2 (>= 6.0.1),
3538
testthat,
@@ -38,5 +41,5 @@ Suggests:
3841
rmarkdown,
3942
rcrossref,
4043
lintr
41-
RoxygenNote: 7.1.0
44+
RoxygenNote: 7.1.1
4245
VignetteBuilder: knitr

‎NAMESPACE‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ importFrom(plyr,llply)
2626
importFrom(purrr,compact)
2727
importFrom(purrr,map)
2828
importFrom(purrr,map_if)
29+
importFrom(rlang,.data)
2930
importFrom(shiny,actionButton)
3031
importFrom(shiny,dialogViewer)
3132
importFrom(shiny,observeEvent)

‎NEWS‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## roadoi 0.7
2+
3+
New features:
4+
5+
- Supports most current Unpaywall data schema (from 20 Jan 2021), including improved detection of delayed OA | thanks @delwen and @Ahobert
6+
- User-friendly interface to access all OA locations in a regular data frame.
7+
8+
Minor fixes:
9+
10+
- bug fix: emails with capital letter were rejected #28 | thanks @rkrug
11+
- CI with GitHub actions
12+
- improved docs
13+
114
## roadoi 0.6
215

316
New features:

‎R/oadoi_fetch.r‎

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
#' You can open your `.Renviron` file calling `file.edit("~/.Renviron")`.
2020
#' Save the file and restart your R session. To stop sharing your email
2121
#' when using rcrossref, delete it from your `.Renviron` file.
22+
#' @param .flatten Simplify open access evidence output. If `TRUE` it
23+
#' transforms the nested column oa_locations so that each open access
24+
#' evidence variable has its own column and each row represents a
25+
#' single full-text.
26+
#' Following these basic principles of "Tidy Data" makes data analysis
27+
#' and export as a spreadsheet more straightforward.
2228
#' @param .progress Shows the \code{plyr}-style progress bar.
2329
#' Options are "none", "text", "tk", "win", and "time".
2430
#' See \code{\link[plyr]{create_progress_bar}} for details
@@ -37,6 +43,10 @@
3743
#' over AcceptedVersion), then more authoritative repositories (PubMed Central
3844
#' over CiteSeerX). \cr
3945
#' \code{oa_locations} \tab list-column of all the OA locations. \cr
46+
#' \code{oa_locations_embargoed} \tab list-column of
47+
#' locations expected to be available in the future based on
48+
#' information like license metadata and journals'
49+
#' delayed OA policies \cr
4050
#' \code{data_standard} \tab Indicates the data collection approaches used
4151
#' for this resource. \code{1} mostly uses Crossref for hybrid detection.
4252
#' \code{2} uses a more comprehensive hybrid detection methods. \cr
@@ -68,9 +78,13 @@
6878
#' name and author role \code{sequence}), if available. \cr
6979
#' }
7080
#'
71-
#' The columns \code{best_oa_location} and \code{oa_locations}
72-
#' are list-columns that contain useful metadata about the OA sources
73-
#' found by Unpaywall. The \code{best_oa_location} only lists non-empty subfields.
81+
#' The columns \code{best_oa_location}. \code{oa_locations} and
82+
#' \code{oa_locations_embargoed} are list-columns that contain
83+
#' useful metadata about the OA sources found by Unpaywall.
84+
#'
85+
#' If \code{.flatten = TRUE} the list-column \code{oa_locations} will be
86+
#' restructured in a long format where each OA fulltext is represented by
87+
#' one row.
7488
#'
7589
#' These are:
7690
#'
@@ -95,24 +109,27 @@
95109
#' \cr
96110
#' }
97111
#'
98-
# nolint end
99-
#' To unnest list-columns, you want to use tidyr's unnest function
100-
#' \code{\link[tidyr]{unnest}}.
101-
#'
102112
#' Note that Unpaywall schema is only informally described.
103113
#' Check also \url{https://unpaywall.org/data-format}.
104114

105115
#' @examples \dontrun{
106116
#' oadoi_fetch("10.1038/nature12373", email = "name@example.com")
107117
#' oadoi_fetch(dois = c("10.1016/j.jbiotec.2010.07.030",
108118
#' "10.1186/1471-2164-11-245"), email = "name@example.com")
119+
#' # flatten OA evidence
120+
#' roadoi::oadoi_fetch(dois = c("10.1186/s12864-016-2566-9",
121+
#' "10.1103/physreve.88.012814",
122+
#' "10.1093/reseval/rvaa038"),
123+
#' email = "najko.jahn@gmail.com", .flatten = TRUE)
124+
#'
109125
#' }
110126
#'
111127
#' @export
112128
oadoi_fetch<-
113129
function(dois=NULL,
114130
email= Sys.getenv("roadoi_email"),
115-
.progress="none") {
131+
.progress="none",
132+
.flatten=FALSE) {
116133
# input validation
117134
stopifnot(!is.null(dois))
118135
# remove empty characters
@@ -129,8 +146,20 @@ oadoi_fetch <-
129146
.call=FALSE
130147
)
131148
# Call API for every DOI, and return results as tbl_df
132-
plyr::llply(dois,oadoi_fetch_,email,.progress=.progress) %>%
149+
req<-plyr::llply(dois,oadoi_fetch_,email,.progress=.progress) %>%
133150
dplyr::bind_rows()
151+
if(.flatten==TRUE){
152+
out<-req %>%
153+
dplyr::select(
154+
-.data$best_oa_location,
155+
-.data$authors,
156+
-.data$oa_locations_embargoed
157+
) %>%
158+
tidyr::unnest(.data$oa_locations,keep_empty=TRUE)
159+
}else {
160+
out<-req
161+
}
162+
return(out)
134163
}
135164

136165
#' Get open access status information.
@@ -178,7 +207,7 @@ oadoi_fetch_ <- function(doi = NULL, email = NULL) {
178207

179208
# error if nothing could be found and return meaningful message
180209
if (httr::status_code(resp)!=200) {
181-
stop(
210+
warning(
182211
sprintf(
183212
"Unpaywall request failed [%s]\n%s",
184213
httr::status_code(resp),
@@ -206,6 +235,7 @@ parse_oadoi <- function(req) {
206235
doi=req$doi,
207236
best_oa_location=list(oa_lct_parser(req$best_oa_location)),
208237
oa_locations=list(tibble::as_tibble(req$oa_locations)),
238+
oa_locations_embargoed=list(tibble::as_tibble(req$oa_locations_embargoed)),
209239
data_standard=req$data_standard,
210240
is_oa=req$is_oa,
211241
is_paratext=req$is_paratext,

‎R/roadoi-package.r‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#' @importFrom purrr map map_if compact
2727
#' @importFrom tibble tibble as_tibble
2828
#' @importFrom tidyr unnest
29+
#' @importFrom rlang .data
2930
#' @name roadoi-package
3031
#' @aliases roadoi
3132
#' @docType package

‎README.Rmd‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ knitr::opts_chunk$set(
1919

2020

2121

22-
roadoi interacts with the[Unpaywall API](http://unpaywall.org/products/api),
22+
roadoi interacts with the[Unpaywall API](https://unpaywall.org/products/api),
2323
a simple web-interface which links DOIs and open access versions of scholarly works.
24-
The API powers[Unpaywall](http://unpaywall.org/).
24+
The API powers[Unpaywall](https://unpaywall.org/).
2525

2626
This client supports the most recent API Version 2.
2727

28-
API Documentation:<http://unpaywall.org/products/api>
28+
API Documentation:<https://unpaywall.org/products/api>
2929

3030
##How do I use it?
3131

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp