Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JDLeongomez committed Dec 22, 2022
2 parents a3f8e4f + 526410e commit b7f2ad2
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 504 deletions.
9 changes: 9 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Leongómez"
given-names: "Juan David"
orcid: "https://orcid.org/0000-0002-0092-6298"
title: "ScolarlyOutput"
date-released: 2022-09-13
url: "https://github.com/JDLeongomez/ScolarlyOutput"
482 changes: 0 additions & 482 deletions README.html

This file was deleted.

48 changes: 40 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# ***ScolarlyOutput***
# ***ScolarlyOutput*** <img src="https://upload.wikimedia.org/wikipedia/commons/c/c7/Google_Scholar_logo.svg" align="right" width=100 height=100 alt=""/>
Plot Plot your scholarly output using the [<code>scholar</code>](https://cran.r-project.org/web/packages/scholar/vignettes/scholar.html) R package

<!-- badges: start -->
![](https://img.shields.io/github/last-commit/JDLeongomez/ScolarlyOutput)
[![License: MIT](https://img.shields.io/badge/License-GPL--3.0-yellow.svg)](https://github.com/JDLeongomez/ScolarlyOutput/blob/main/LICENSE)
<!-- badges: end -->

**_ScolarlyOutput_** is a small R Shiny app for creating and exporting a complete plot of your academic [**Google Scholar**](https://scholar.google.com/) profile.

It only requires the full link to your Google Scholar profile (just copy it and paste it in the box), and it will create a plot with your name (as it appears on your Gsoogle Scholar profile) and two panels:
It only requires the full link to your Google Scholar profile (just copy it and paste it in the box), and it will create a plot with your name (as it appears on your Google Scholar profile) and two panels:

<ol type="A">
<li>Citations per publication (including h- and g-index)</li>
<li>Number of publications and citations per year (including total number of citations)</li>
<li><b>Citations per publication</b> including both your h-index and, importantly, <a href="https://en.wikipedia.org/wiki/G-index">g-index</a> (which I have never seen in plots before)</li>
<li><b>Number of publications and citations per year</b> including total number of citations</li>
</ol>

Below is an example of the **_ScolarlyOutput_** UI showing a plot of my own profile:
Expand All @@ -23,21 +29,47 @@ The downloaded plot (in this case, as PNG) looks like this:

![ScolarlyOutput plot example](img/Scholar_profile.png)

This app uses the fantastic [<code>scholar</code>](https://cran.r-project.org/web/packages/scholar/vignettes/scholar.html) R package to extract the info from your Google Scholar profile, and then several [<code>tidyverse</code>](https://www.tidyverse.org/) packages (most notably [<code>ggplot2</code>](https://ggplot2.tidyverse.org/)) to wrangle and plot these data.
This app uses the fantastic [<code>scholar</code>](https://cran.r-project.org/web/packages/scholar/vignettes/scholar.html) R package to extract the info from your Google Scholar profile, and then several packages (mostly [<code>tidyverse</code>](https://www.tidyverse.org/) packages including [<code>ggplot2</code>](https://ggplot2.tidyverse.org/)) to wrangle and plot these data.

## How to run it

Sadly, the [<code>scholar</code>](https://cran.r-project.org/web/packages/scholar/vignettes/scholar.html) package cannot be run from a server like shinyapps.io, so this app must be run locally in your computer with R installed.

However, running it is very easy: you can simply run the code below in R (please note that the [<code>shiny</code>](https://shiny.rstudio.com/) package must be installed):
However, running it is very easy: you can simply run the code below in R:

```R
#install.packages("shiny")
library(shiny)
runGitHub("ScolarlyOutput", "JDLeongomez")
```
Alternatively, you can always clone or [download](https://github.com/JDLeongomez/ScolarlyOutput/archive/refs/heads/main.zip) the **_ScolarlyOutput_** repository, and run the [<code>app.R</code>](https://github.com/JDLeongomez/ScolarlyOutput/blob/main/app.R) file.

<details>
<summary><b>Click here to make sure you have all the necessary packages installed</b></summary>
<br>Please note that the <code>shiny</code> package must be installed. Other R packages used in this app include <code>thematic</code>, <code>shinythemes</code>, <code>colourpicker</code>, <code>stringr</code>, <code>scholar</code>, <code>dplyr</code>, <code>tidyr</code>, <code>ggplot2</code>, <code>ggpubr</code>, <code>scales</code>, and <code>purrr</code>.<br><br>

If you want, you can first run the following code, which will check which of these packages are already installed on your computer, and install the missing ones (if any).

Alternatively, you can always [download](https://github.com/JDLeongomez/ScolarlyOutput/archive/refs/heads/main.zip) the **_ScolarlyOutput_** repository, and run the [<code>app.R</code>](https://github.com/JDLeongomez/ScolarlyOutput/blob/main/app.R) file.
```R
# Required packages
packages <- c("shiny",
"thematic",
"shinythemes",
"colourpicker",
"stringr",
"scholar",
"dplyr",
"tidyr",
"ggplot2",
"ggpubr",
"scales",
"purrr")
# Install packages not yet installed
installed_packages <- packages %in% rownames(installed.packages())
if (any(installed_packages == FALSE)) {
install.packages(packages[!installed_packages])
}
```
</details>

## Why I made this super small app

Expand Down
29 changes: 15 additions & 14 deletions app.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,15 @@ server <- function(input, output) {
res = 120,
{
#Define Scholar profile
pfl <- input$profl %>% str_split(pattern = 'user\\=') %>%
map_chr(c(2)) %>%
pfl <- input$profl |>
str_split(pattern = 'user\\=') |>
map_chr(c(2)) |>
str_sub(start = 1, end = 12)

#Get data from Scholar (filtering specific non-academic publications)
##Publications
pubs <- get_publications(pfl) %>%
filter(!(journal == "" | journal == "target")) %>%
pubs <- get_publications(pfl) |>
filter(!(journal == "" | journal == "target")) |>
filter(!(year == "" | year < input$minyear))

##Citations
Expand All @@ -124,19 +125,19 @@ server <- function(input, output) {
##Define years (from year of first publication to current year)
years <- data.frame(year = c(min(pubs$year, na.rm = TRUE):as.numeric(format(Sys.Date(),'%Y'))))
##Get number of publications per year
pd <- pubs %>%
group_by(year) %>%
summarise(pt = length(year)) %>%
pd <- pubs |>
group_by(year) |>
summarise(pt = length(year)) |>
drop_na(year)
##Merge years and number of publications per year
pt <- years %>%
full_join(pd) %>%
pt <- years |>
full_join(pd) |>
arrange(year)
##Add number of citations per year
dat <- pt %>%
full_join(ct) %>%
arrange(year) %>%
mutate(year = as.integer(year)) %>%
dat <- pt |>
full_join(ct) |>
arrange(year) |>
mutate(year = as.integer(year)) |>
mutate(across(everything(), ~replace_na(.x, 0)))

#Calculate metrics
Expand All @@ -145,7 +146,7 @@ server <- function(input, output) {
##Total number of citations
citSum <- profile$total_cites
##Recent citations (last three years)
citRecentSum <- ct %>%
citRecentSum <- ct |>
summarize(sumB = sum(cites[year >= yearRecent]))
##Number of publications with more than 50 citations
count50cit <- nrow(ct[ct$cites > 50, ])
Expand Down

0 comments on commit b7f2ad2

Please sign in to comment.