# scholar: Analyse citation data from Google Scholar

#### Guangchuang Yu, James Keirstead and Gregory Jefferis

#### 2022-08-09

# Retrieving basic information

    ## Define the id for Richard Feynman
    id <- 'B7vSqZsAAAAJ'

    ## Get his profile
    l <- get_profile(id)

    ## Print his name and affliation
    l$name

    ## [1] "Richard Feynman"

    l$affiliation

    ## [1] "California Institute of Technology"

    ## Print his citation index
    l$h_index

    ## [1] 59

    l$i10_index

    ## [1] 97

# Retrieving publications

`get_publications()` return a `data.frame` of publication records. It contains information of the publications, including title, author list, page number, citation number, publication year, etc..

The `pubid` is the article ID used by Google Scholar and the identifier that is used to retrieve the citation history of a selected publication.

    ## Get his publications (a large data frame)
    p <- get_publications(id)
    head(p, 3)

    ##                                    title
    ## 1 Quantum mechanics and path integration
    ## 2        The Feynman lectures on physics
    ## 3         TheFeynman lectures on physics
    ##                                                               author
    ## 1                                               RP Feynman, AR Hibbs
    ## 2                       RP Feynman, RB Leighton, M Sands, SB Treiman
    ## 3 RP Feynman, RB Leighton, M Sands, CA Heras, R Gómez, E Oelker, ...
    ##                                journal number cites year
    ## 1                          McGraw–Hill        30948 1965
    ## 2                        Physics Today 17, 45 17707 1964
    ## 3 Fondo Educativo Interamericano, cop.        17447 1971
    ##                                                                                                                                                                                                                                                cid
    ## 1                                                                                                                                                                                   14769952204323476283,12549707430555464374,17914366645132260192
    ## 2                                                                                                                                           14769952204323476283,15649786516955137750,9018562047232646150,13112633961799421939,3669163321259408309
    ## 3 14769952204323476283,14916754439012518946,3384894241901148750,10013291528877493387,6950149260037791747,2796131643738233855,44985079034195671,9597590102184001665,788740732818767427,6704149347623579050,2968587135607687418,16196770756402817702
    ##          pubid
    ## 1 hMod-77fHWUC
    ## 2 u-x6o8ySG0sC
    ## 3 SP6oXDckpogC

# Retrieving citation data

    ## Get his citation history, i.e. citations to his work in a given year
    ct <- get_citation_history(id)

    ## Plot citation trend
    library(ggplot2)
    ggplot(ct, aes(year, cites)) + geom_line() + geom_point()

Users can retrieve the citation history of a particular publication with `get_article_cite_history()`.

    ## The following publication will be used to demonstrate article citation history
    as.character(p$title[1])

    ## [1] "Quantum mechanics and path integration"

    ## Get article citation history
    ach <- get_article_cite_history(id, p$pubid[1])

    ## Plot citation trend
    ggplot(ach, aes(year, cites)) +
        geom_segment(aes(xend = year, yend = 0), size=1, color='darkgrey') +
        geom_point(size=3, color='firebrick')

# Comparing scholars

You can compare the citation history of scholars by fetching data with `compare_scholars`.

    # Compare Feynman and Stephen Hawking
    ids <- c('B7vSqZsAAAAJ', 'qj74uXkAAAAJ')

    # Get a data frame comparing the number of citations to their work in
    # a given year
    cs <- compare_scholars(ids)

    ## remove some 'bad' records without sufficient information
    cs <- subset(cs, !is.na(year) & year > 1900)
    ggplot(cs, aes(year, cites, group=name, color=name)) + geom_line() + theme(legend.position="bottom")

    ## Compare their career trajectories, based on year of first citation
    csc <- compare_scholar_careers(ids)
    ggplot(csc, aes(career_year, cites, group=name, color=name)) + geom_line() + geom_point() +
        theme(legend.position=c(.2, .8))

# Visualizing and comparing network of coauthors

    # Be careful with specifying too many coauthors as the visualization of the
    # network can get very messy.
    coauthor_network <- get_coauthors('amYIKXQAAAAJ&hl', n_coauthors = 7)

    coauthor_network

    ##                        author                  coauthors
    ## 1  Herman G. Van De Werfhorst                  Thijs Bol
    ## 2  Herman G. Van De Werfhorst            Daniele Checchi
    ## 3  Herman G. Van De Werfhorst         István György Tóth
    ## 4  Herman G. Van De Werfhorst Jonathan Jan Benjamin Mijs
    ## 5  Herman G. Van De Werfhorst         Frank Van Tubergen
    ## 6  Herman G. Van De Werfhorst            Wiemer Salverda
    ## 7  Herman G. Van De Werfhorst                   Ive Marx
    ## 8                   Thijs Bol Herman G. Van De Werfhorst
    ## 9                   Thijs Bol             Andrea Forster
    ## 10                  Thijs Bol         Arnout Van De Rijt
    ## 11                  Thijs Bol            Mathijs De Vaan
    ## 12                  Thijs Bol     Christina Ciocca Eller
    ## 13                  Thijs Bol                Bram Lancee
    ## 14                  Thijs Bol             Thomas Leopold
    ## 15            Daniele Checchi        Massimiliano Bratti
    ## 16            Daniele Checchi           Giorgio Brunello
    ## 17            Daniele Checchi              Vito Peragine
    ## 18            Daniele Checchi             Marco Leonardi
    ## 19            Daniele Checchi Herman G. Van De Werfhorst
    ## 20            Daniele Checchi            Wiemer Salverda
    ## 21            Daniele Checchi           Giuseppe Bertola
    ## 22         István György Tóth Herman G. Van De Werfhorst
    ## 23         István György Tóth            Daniele Checchi
    ## 24         István György Tóth                   Ive Marx
    ## 25         István György Tóth                Brian Nolan
    ## 26         István György Tóth            Wiemer Salverda
    ## 27         István György Tóth               Tamás Keller
    ## 28         István György Tóth             Orsolya Lelkes
    ## 29 Jonathan Jan Benjamin Mijs Herman G. Van De Werfhorst
    ## 30 Jonathan Jan Benjamin Mijs               Maurice Crul
    ## 31 Jonathan Jan Benjamin Mijs               Bowen Paulle
    ## 32 Jonathan Jan Benjamin Mijs                Noam Gidron
    ## 33 Jonathan Jan Benjamin Mijs             Michele Lamont
    ## 34 Jonathan Jan Benjamin Mijs            Elyas Bakhtiari
    ## 35 Jonathan Jan Benjamin Mijs            Christopher Hoy
    ## 36         Frank Van Tubergen                 Ineke Maas
    ## 37         Frank Van Tubergen           Matthijs Kalmijn
    ## 38         Frank Van Tubergen Herman G. Van De Werfhorst
    ## 39         Frank Van Tubergen            Agnieszka Kanas
    ## 40         Frank Van Tubergen                Sanne Smith
    ## 41         Frank Van Tubergen           Thomas De Vroome
    ## 42         Frank Van Tubergen            Marcel Coenders
    ## 43            Wiemer Salverda                Brian Nolan
    ## 44            Wiemer Salverda                   Ive Marx
    ## 45            Wiemer Salverda            Daniele Checchi
    ## 46            Wiemer Salverda Herman G. Van De Werfhorst
    ## 47            Wiemer Salverda           Lucifora Claudio
    ## 48            Wiemer Salverda         István György Tóth
    ## 49            Wiemer Salverda              Stephen Bazen
    ## 50                   Ive Marx              Bea Cantillon
    ## 51                   Ive Marx              Sarah Marchal
    ## 52                   Ive Marx            Wiemer Salverda
    ## 53                   Ive Marx            Daniele Checchi
    ## 54                   Ive Marx Herman G. Van De Werfhorst
    ## 55                   Ive Marx             Johan Fritzell
    ## 56                   Ive Marx             Gert G. Wagner

And then we have a built-in function to plot this visualization.

    plot_coauthors(coauthor_network)

    ## Warning: Removed 32 rows containing missing values (geom_point).

Note however, that these are the coauthors listed in Google Scholar profile and not coauthors from all publications.