Skip to content
Prev 10863 / 12125 Next

[R-pkg-devel] ORCID ID finder via tools::CRAN_package_db() ?

Dirk et al,

Sorry for not replying any sooner :-)

I think for now you could use something like what I attach below.

Not ideal: I had not too long ago starting adding orcidtools.R to tools,
which e.g. has .persons_from_metadata(), but that works on the unpacked
sources and not the CRAN package db.  Need to think about that ...

Best
-k

********************************************************************
x <- tools::CRAN_package_db()
a <- lapply(x[["Authors at R"]],
            function(a) {
                if(!is.na(a)) {
                    a <- tryCatch(utils:::.read_authors_at_R_field(a), 
                                  error = identity)
                    if (inherits(a, "person")) 
                        return(a)
                }
                NULL
            })
a <- do.call(c, a)
a <- lapply(a,
            function(e) {
                if(is.null(o <- e$comment["ORCID"]) || is.na(o))
                    return(NULL)
                cbind(given = paste(e$given, collapse = " "),
                      family = paste(e$family, collapse = " "),
                      oid = unname(o))
            })
a <- as.data.frame(do.call(rbind, a))
********************************************************************

Thread (20 messages)