ropensci / roadoi

Use Unpaywall with R
https://docs.ropensci.org/roadoi
Other
64 stars 3 forks source link

No DOI should result in empty list with same format #20

Closed patrickda closed 6 years ago

patrickda commented 6 years ago

Not sure is this the same as #19.

If I try to process a not complete list of DOIs like:

DOIs <- c("10.1016/j.jbiotec.2010.07.030","10.1186/1471-2164-11-245","") OAStatus <- oadoi_fetch(dois= DOIs,email = "example@email.com")

I got the following result:

Fehler: Columns doi, data_standard, is_oa, journal_issns, journal_name, publisher, title, updated must be 1d atomic vectors or lists Zusätzlich: Warnmeldung: In is.na(req$journal_is_oa) : is.na() auf nicht-(Liste oder Vektor) des Typs 'NULL' angewendet

The incomplete DOI list I got from a publication database. The result I like to merge easy with the existing data. Certainly there are workarounds for the problem but it would be nice if this would work out of the box.

njahn82 commented 6 years ago

Hi @patrickda

I extended DOI input validation for empty characters. To install

devtools::install_github("ropensci/roadoi")

I am unsure about how to return non-succesful candidates, will have a look into it.

njahn82 commented 6 years ago

To make sure, you want something like this to be returned:

# A tibble: 4 x 13
                        dois best_oa_location      oa_locations data_standard is_oa
                       <chr>           <list>            <list>         <int> <lgl>
1                                      <NULL>            <NULL>            NA    NA
2                       <NA>           <NULL>            <NULL>            NA    NA
3  10.1186/s12864-016-2566-9 <tibble [1 x 9]> <tibble [3 x 10]>             2  TRUE
4 10.1103/physreve.88.012814 <tibble [1 x 9]> <tibble [1 x 10]>             2  TRUE
# ... with 8 more variables: journal_is_oa <lgl>, journal_issns <chr>, journal_name <chr>,
#   publisher <chr>, title <chr>, year <chr>, updated <chr>, non_compliant <list>

Should the order be preserved?

patrickda commented 6 years ago

Thanks thats totally fine.