ropensci / openalexR

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

oa_fetch worked for one but failed for another. #137

Closed yhan818 closed 1 year ago

yhan818 commented 1 year ago

I have a very strange issue. Is this related OpenAlex author upgrade? or is it a bug with oa_fetch?

I can search

author_from_names <- oa_fetch(entity = "author", search = "Bekir Tanriover" ) It returned "1 obs. of 16 variables".

However, if I have the next line, I got error messages. I could not think of any reason.

author_from_names <- oa_fetch(entity = "author", search = "Haw-chih Tai" ) Error in (function (..., deparse.level = 1, make.row.names = TRUE, stringsAsFactors = FALSE, : numbers of columns of arguments do not match

author_from_names <- oa_fetch(entity = "author", search = "Karen Padilla" ) Error in (function (..., deparse.level = 1, make.row.names = TRUE, stringsAsFactors = FALSE, : numbers of columns of arguments do not match

yjunechoe commented 1 year ago

I can't seem to replicate this error - can you retry with the latest development version?

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

Same here. These seem to be working for me @yhan818 .

library(openalexR)
#> Thank you for using openalexR!
#> To acknowledge our work, please cite the package by calling
#> `citation("openalexR")`.
oa_fetch(entity = "author", search = "Bekir Tanriover")
#> # A tibble: 1 × 16
#>   id         displ…¹ displ…² relev…³ ids   orcid works…⁴ cited…⁵ count…⁶ affil…⁷
#>   <chr>      <chr>   <list>    <dbl> <lis> <chr>   <int>   <int> <list>  <lgl>  
#> 1 https://o… Bekir … <chr>     4222. <chr> http…      80    1428 <df>    NA     
#> # … with 6 more variables: affiliation_id <lgl>, affiliation_ror <lgl>,
#> #   affiliation_country_code <lgl>, affiliation_type <lgl>, x_concepts <list>,
#> #   works_api_url <chr>, and abbreviated variable names ¹​display_name,
#> #   ²​display_name_alternatives, ³​relevance_score, ⁴​works_count,
#> #   ⁵​cited_by_count, ⁶​counts_by_year, ⁷​affiliation_display_name
oa_fetch(entity = "author", search = "Haw-chih Tai")
#> # A tibble: 4 × 16
#>   id         displ…¹ displ…² relev…³ ids   orcid works…⁴ cited…⁵ count…⁶ affil…⁷
#>   <chr>      <chr>   <list>    <dbl> <lis> <chr>   <int>   <int> <list>  <lgl>  
#> 1 https://o… Haw Ch… <chr>     1032. <chr> <NA>        3      92 <df>    NA     
#> 2 https://o… Haw-Ch… <chr>      665. <chr> http…       2      38 <df>    NA     
#> 3 https://o… Haw-Ch… <chr>      265. <chr> http…       2       6 <df>    NA     
#> 4 https://o… Haw-Ch… <chr>       NA  <chr> <NA>        1       0 <df>    NA     
#> # … with 6 more variables: affiliation_id <lgl>, affiliation_ror <lgl>,
#> #   affiliation_country_code <lgl>, affiliation_type <lgl>, x_concepts <list>,
#> #   works_api_url <chr>, and abbreviated variable names ¹​display_name,
#> #   ²​display_name_alternatives, ³​relevance_score, ⁴​works_count,
#> #   ⁵​cited_by_count, ⁶​counts_by_year, ⁷​affiliation_display_name
oa_fetch(entity = "author", search = "Karen Padilla")
#> # A tibble: 31 × 16
#>    id        displ…¹ displ…² relev…³ ids   orcid works…⁴ cited…⁵ count…⁶ affil…⁷
#>    <chr>     <chr>   <list>    <dbl> <lis> <chr>   <int>   <int> <list>  <lgl>  
#>  1 https://… Karen … <chr>    2231.  <chr> <NA>       18     932 <df>    NA     
#>  2 https://… Karen … <chr>     241.  <chr> <NA>        6      15 <df>    NA     
#>  3 https://… Karen … <chr>      88.0 <chr> <NA>        1       2 <df>    NA     
#>  4 https://… Karen … <chr>      68.3 <chr> <NA>        1       2 <df>    NA     
#>  5 https://… Karen … <chr>      62.5 <chr> <NA>        1       1 <df>    NA     
#>  6 https://… Karen … <chr>      62.2 <chr> <NA>        3       1 <df>    NA     
#>  7 https://… Karen … <chr>      47.0 <chr> <NA>        1       3 <df>    NA     
#>  8 https://… Karen … <chr>      38.4 <chr> <NA>        3       2 <df>    NA     
#>  9 https://… Karen … <chr>      27.2 <chr> <NA>        1       1 <df>    NA     
#> 10 https://… Karen … <chr>      27.2 <chr> <NA>        1       1 <df>    NA     
#> # … with 21 more rows, 6 more variables: affiliation_id <lgl>,
#> #   affiliation_ror <lgl>, affiliation_country_code <lgl>,
#> #   affiliation_type <lgl>, x_concepts <list>, works_api_url <chr>, and
#> #   abbreviated variable names ¹​display_name, ²​display_name_alternatives,
#> #   ³​relevance_score, ⁴​works_count, ⁵​cited_by_count, ⁶​counts_by_year,
#> #   ⁷​affiliation_display_name

Created on 2023-07-27 with reprex v2.0.2

yhan818 commented 1 year ago

Thank you both for checking! I use the development version. It worked. (Note: have to use "force=TRUE" to install the latest development version).

remotes::install_github("ropensci/openalexR", force=TRUE)

If I loaded the current version (openalexR_1.1.0.tar.gz) ) by "install.packages("openalexR") " (which uses URL 'https://cloud.r-project.org/src/contrib/openalexR_1.1.0.tar.gz') ), I can reproduce the error.

It is great that the new version 1.2.0 will be released soon.