ropensci-archive / rorcid

:warning: ARCHIVED :warning: A programmatic interface the Orcid.org API
Other
109 stars 13 forks source link

Error using multiple ORCID ID's #46

Closed jofazepa closed 6 years ago

jofazepa commented 6 years ago

When using rOrcid for multiple to get multiple ORCID, and this didn't happen before, just like the example in the tutorial:

ids <- c("0000-0003-1620-1408", "0000-0002-9341-7985")
lapply(orcid_id(orcid = ids), "[[", "orcid-identifier")

Returns this. I believe is a ddply problem with summarize, maybe mutate will solve the problem.

> Error: length(orcid) == 1 is not TRUE
sckott commented 6 years ago

thanks for the issue @jofazepa

can you share your sessionInfo() please

jofazepa commented 6 years ago

R version 3.4.3 (2017-11-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=Portuguese_Portugal.1252 LC_CTYPE=Portuguese_Portugal.1252 LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Portugal.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] rorcid_0.4.0

loaded via a namespace (and not attached): [1] httr_1.3.1 compiler_3.4.3 R6_2.2.2 tools_3.4.3 curl_3.1 yaml_2.1.17 crul_0.5.2 jsonlite_1.5

sckott commented 6 years ago

The new version of rorcid has some changes, one of which is orcid_id only accepts one ORCID.

you're looking for just getting the same ORCID id again from the result?

ids <- c("0000-0003-1620-1408", "0000-0002-9341-7985")
lapply(ids, function(x) names(orcid_id(x)))
jofazepa commented 6 years ago

I used to get bulk publications/work for multiple ORCID Ids, using this: x <- orcid_id(orcid = ids, profile = "works") When I got the error I just run through the rORCID tutorial and found the code I pasted here. Also tried other ways, like x <- lapply(orcid_id(orcid = ids), "[[", "orcid-identifier") And the same error happens. I was looking for a way to do the same thing, because that is why I use rORCID for, getting info from a group of researchers, but I see that the new version or rOrcid is unable to do it.

sckott commented 6 years ago

it is able to do that if you slightly change your code.

this in the new verison

ids <- c("0000-0003-1620-1408", "0000-0002-9341-7985")
lapply(ids, function(x) names(orcid_id(x)))

does exactly what this did in the old version

ids <- c("0000-0003-1620-1408", "0000-0002-9341-7985")
lapply(orcid_id(orcid = ids), "[[", "orcid-identifier")
jofazepa commented 6 years ago

This means that if I change "names" for "works" I get the works from them, like this: x <- lapply(ids, function(x) works(orcid_id(x))) Therefore just needing to change the list to a data.frame to be able to have an organized publications list for a set of orcid.ids.

sckott commented 6 years ago

right, the eg. I gave with names() was to just get exactly what your example code was doing. right, so just lapply or similar over your ORCID's

jofazepa commented 6 years ago

Thanks sckott.