ropensci / openalexR

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

oa_fetch authors returns "Error in rbind(deparse.level, ...) : numbers of columns of arguments do not match" #197

Closed amacanovic closed 8 months ago

amacanovic commented 8 months ago

Dear OpenAlexR team,

When I try to retrieve author data using multiple OA IDs, I sometimes run into the following error:

Error in rbind(deparse.level, ...) : numbers of columns of arguments do not match

Here is an example with a list of IDs that returns an error for me:

id_list <- c("https://openalex.org/A5060327933", "https://openalex.org/A5043212291", "https://openalex.org/A5013893618",
"https://openalex.org/A5083205873", "https://openalex.org/A5028225080",
"https://openalex.org/A5045771927", "https://openalex.org/A5087961420", "https://openalex.org/A5061969520", "https://openalex.org/A5087333500", "https://openalex.org/A5028983389",
"https://openalex.org/A5028321251", "https://openalex.org/A5080613413", "https://openalex.org/A5050168518", "https://openalex.org/A5017007551", "https://openalex.org/A5021952279",
"https://openalex.org/A5016640081", "https://openalex.org/A5006336101", "https://openalex.org/A5073759525", "https://openalex.org/A5008901955", "https://openalex.org/A5061825470",
"https://openalex.org/A5010064454", "https://openalex.org/A5022493416", "https://openalex.org/A5039157494", "https://openalex.org/A5025529510", "https://openalex.org/A5060670532",
"https://openalex.org/A5022019957", "https://openalex.org/A5085138098", "https://openalex.org/A5025536761", "https://openalex.org/A5073037730", "https://openalex.org/A5027141377",
"https://openalex.org/A5036435266", "https://openalex.org/A5070099818", "https://openalex.org/A5084439486", "https://openalex.org/A5076649800", "https://openalex.org/A5073561747",
"https://openalex.org/A5084988620", "https://openalex.org/A5065025152", "https://openalex.org/A5022894825", "https://openalex.org/A5047182483", "https://openalex.org/A5000313679",
"https://openalex.org/A5002637866", "https://openalex.org/A5010714844", "https://openalex.org/A5012203131", "https://openalex.org/A5009217636", "https://openalex.org/A5063142813",
"https://openalex.org/A5053380780", "https://openalex.org/A5090185364", "https://openalex.org/A5073972687", "https://openalex.org/A5084671025", "https://openalex.org/A5043902193",
"https://openalex.org/A5047141474")

output <- oa_fetch(
    entity = "authors", 
    openalex_id = id_list)

It seems to happen when calls for different IDs return different numbers of columns with author info, but I could not figure out when does it exactly happen (as sometimes I manage to retrieve a few hundred IDs just fine). I can solve this by retrieving info for the results one by one and tidying it up manually, but I am still wondering why some calls are failing like this.

Thanks in advance!

yjunechoe commented 8 months ago

Thanks! I can reproduce the error. I've proposed a PR for the fix - you can see if it also works for you with:

remotes::install_github("ropensci/openalexR#198")
amacanovic commented 8 months ago

Thanks so much! It now also works on my side; and I don't see any errors when pulling some other IDs that were problematic in the past.