R/cv.R
add_scholar_cites_to_bib.Rd
This is a rather specific function designed for my (Greg's) CV, based on
initial work by James Manton. The idea is that the bib file (probably
produced by BibDesk) contains a list of publications with google ids
specified in the bibtex field googlescholarid
; at present these must
all have one single google scholar author (denoted by author_id
) as a
co-author.
add_scholar_cites_to_bib(author_id, bibin, bibout = NULL, citekeys = NULL, clean = TRUE, Force = TRUE)
author_id | The google scholar author id |
---|---|
bibin, bibout | The input and output bibtex files. |
citekeys | An optional vector specifying a subset of citekeys to use. |
clean | Whether to remove difficult fields / clean up input file |
Force | Whether to insist on updating the output file (see
|
The function first cleans up the input bib file by removing long, irrelevant
fields. It then fetches the publication list from google scholar for the
specified author_id
using get_publications
(
which returns a data.frame including the scholar publication ids and citation
counts). This information is then merge with the bibtex file and new/updated
citation counts are placed in the bibtex field citationnum
.
By default the output is written to a new bibtex file called
<bibin_stem>_scholarcites.bib
. Note that this process is lossy
since some fields are dropped and therefore it is not recommended to
overwrite the original input file.
if (FALSE) { add_scholar_cites_to_bib("cuXoCA8AAAAJ", 'mypubs.bib') f="~/Greg/ProfessionalAdmin/cv_lyx/JefferisPublications.bib" bdsk_groups=read_bibdesk_static_groups(f) add_scholar_cites_to_bib("cuXoCA8AAAAJ", f, citekeys=bdsk_groups$SelectedCandidates) ## a sample rmarkdown chunk: # nb the block should have options like: # ```r bibstuff, echo=FALSE, results="hide", message=FALSE, warning=FALSE``` # to avoid potentially distracting messages. library(paperutils) add_scholar_cites_to_bib("cuXoCA8AAAAJ", "~/cv/JefferisPublications.bib") # produces "~/cv/JefferisPublications_scholarcites.bib" library(scholar) gs_prof=get_profile("cuXoCA8AAAAJ") }