ropensci / openalexR

Getting bibliographic records from OpenAlex
https://docs.ropensci.org/openalexR/
Other
91 stars 20 forks source link

Problem with oa_fetch #156

Closed JeffreySmithA closed 1 year ago

JeffreySmithA commented 1 year ago

Hi (again!),

Similar to the thread below, I'm facing a problem with oa_fetch.

For example:

timothy_jackson_oa <- oa_fetch( author.id = "A5015292781", entity = "works", verbose = TRUE )

I face an error:

Requesting url: https://api.openalex.org/works?filter=author.id%3AA5015292781 Getting 1 page of results with a total of 74 records... Error in (function (..., deparse.level = 1, make.row.names = TRUE, stringsAsFactors = FALSE, : numbers of columns of arguments do not match

Before, this function worked perfectly well but now I'm running into an error.

mancebral commented 1 year ago

Hi (again!),

Similar to the thread below, I'm facing a problem with oa_fetch.

For example:

timothy_jackson_oa <- oa_fetch( author.id = "A5015292781", entity = "works", verbose = TRUE )

I face an error:

Requesting url: https://api.openalex.org/works?filter=author.id%3AA5015292781 Getting 1 page of results with a total of 74 records... Error in (function (..., deparse.level = 1, make.row.names = TRUE, stringsAsFactors = FALSE, : numbers of columns of arguments do not match

Before, this function worked perfectly well but now I'm running into an error.

Yes, same error with oa_fetch; but as long as I remember this function worked a month ago providing "tibble" or "dataframes" not just "lists".

JeffreySmithA commented 1 year ago

Hey Manuel,

Sorry I didn't follow your comment. How would I change the function make it work?

Thanks!

yjunechoe commented 1 year ago

~Thanks for the report! I can reproduce this error.~

~Looks like the error popped up due to the openalex database adding a "institution lineage" field to the authors metadata yesterday. But the coverage of this field is spotty, so some authors have "institution lineage" this while others don't. I'll draft a PR to address this new development.~

Actually nvm @trangdata already got to this! You can wait for #155 to be merged.

What the output looks like in that PR:

timothy_jackson_oa <- oa_fetch(
  author.id = "A5015292781",
  entity = "works",
  verbose = TRUE
)
#> Requesting url: https://api.openalex.org/works?filter=author.id%3AA5015292781
#> Getting 1 page of results with a total of 74 records...
timothy_jackson_oa
#> # A tibble: 74 × 36
#>    id       display_name author ab    publication_date so    so_id host_organization issn_l url   pdf_url license version first_page last_page volume
#>    <chr>    <chr>        <list> <chr> <chr>            <chr> <chr> <chr>             <chr>  <chr> <chr>   <lgl>   <chr>   <chr>      <chr>     <chr> 
#>  1 https:/… Rich Rastas… <df>   ""    1991-12-01       The … http… Wiley-Blackwell   0022-… http… <NA>    NA      <NA>    <NA>       <NA>      <NA>  
#>  2 https:/… Anthropolog… <df>   "Thi… 2004-03-01       Anth… http… SAGE Publishing   1463-… http… <NA>    NA      <NA>    5          28        4     
#>  3 https:/… Handbook of… <df>   ""    2012-02-20       Rout… http… <NA>              <NA>   http… <NA>    NA      <NA>    <NA>       <NA>      <NA>  
#>  4 https:/… This Time W… <df>   "We … 1998-09-01       Cont… http… SAGE Publishing   0094-… http… <NA>    NA      <NA>    <NA>       <NA>      <NA>  
#>  5 https:/… Notes from … <df>   ""    1996-10-01       The … http… Wiley-Blackwell   0036-… http… <NA>    NA      <NA>    727        727       55    
#>  6 https:/… Is genocide… <df>   "Pre… 2003-12-01       Jour… http… Taylor & Francis  1462-… http… <NA>    NA      <NA>    523        542       5     
#>  7 https:/… The Bridge … <df>   ""    1998-01-01       Slav… http… American Associa… 0037-… http… <NA>    NA      <NA>    <NA>       <NA>      <NA>  
#>  8 https:/… Notes from … <df>   ""    1996-09-01       Cont… http… SAGE Publishing   0094-… http… <NA>    NA      <NA>    685        685       25    
#>  9 https:/… A Matter of… <df>   "Ack… 2005-11-07       <NA>  <NA>  <NA>              <NA>   http… <NA>    NA      <NA>    <NA>       <NA>      <NA>  
#> 10 https:/… The Religio… <df>   "A p… 2009-02-16       Camb… http… <NA>              <NA>   http… <NA>    NA      <NA>    <NA>       <NA>      <NA>  
#> # ℹ 64 more rows
#> # ℹ 20 more variables: issue <chr>, is_oa <lgl>, is_oa_anywhere <lgl>, oa_status <chr>, oa_url <chr>, any_repository_has_fulltext <lgl>,
#> #   language <chr>, grants <lgl>, cited_by_count <int>, counts_by_year <list>, publication_year <int>, cited_by_api_url <chr>, ids <list>,
#> #   doi <chr>, type <chr>, referenced_works <list>, related_works <list>, is_paratext <lgl>, is_retracted <lgl>, concepts <list>
mancebral commented 1 year ago

Hey Manuel,

Sorry I didn't follow your comment. How would I change the function make it work?

Thanks!

Yes, finally it works intalling the version of the package you left on GitHub !!!

trangdata commented 1 year ago

Hi @JeffreySmithA yes this issue is similar to #154 and the fix in #155 has been merged. Could you please try re-installing the package from GitHub and try your oa_fetch call again? 🙏🏽

# install.packages("remotes")
remotes::install_github("ropensci/openalexR")
JeffreySmithA commented 1 year ago

Yes, this worked - much appreciated!