diff options
author | Ken Kellner <ken@kenkellner.com> | 2022-12-01 09:51:06 -0500 |
---|---|---|
committer | Ken Kellner <ken@kenkellner.com> | 2022-12-01 09:51:06 -0500 |
commit | bfd79227c22b81b8b2b5ea060bffdd6c2a47fb61 (patch) | |
tree | 77e49fb38d45e123309d205c1a0db39f73b033f2 | |
parent | 32f92ee07f4614ab6d2b899d33c54d4c372f3b32 (diff) |
Drop citation figure
-rw-r--r-- | citations.R | 22 | ||||
-rw-r--r-- | unm-scholar.R | 38 |
2 files changed, 22 insertions, 38 deletions
diff --git a/citations.R b/citations.R new file mode 100644 index 0000000..855daad --- /dev/null +++ b/citations.R @@ -0,0 +1,22 @@ +library(scholar) + +# Get article ID +id <- "HdZX5qUAAAAJ" +art <- get_publications(id, cstart = 0, pagesize = 100, flush = FALSE) +pub <- as.character(art$pubid[1]) + +# Get citation stats +art_dat <- get_article_cite_history(id, pub) +art_dat$year <- format(as.Date(paste(art_dat$year, 1, 1, sep="-")), "%Y") +art_dat$year <- as.numeric(art_dat$year) +art_dat <- art_dat[art_dat$year %in% 2011:2022,] +stopifnot(nrow(art_dat) == 12) + +# Calculated on 11-30-2022 +total_cites <- sum(art_dat$cites) +total_cites # 2100 +stopifnot(total_cites >= 2000) + +mean_cites <- mean(art_dat$cites[8:12]) +mean_cites # 266.4 +stopifnot(mean_cites >= 250) diff --git a/unm-scholar.R b/unm-scholar.R deleted file mode 100644 index e9cd6a5..0000000 --- a/unm-scholar.R +++ /dev/null @@ -1,38 +0,0 @@ -library(scholar) -library(ggplot2) -library(cowplot) - -id <- "HdZX5qUAAAAJ" - -art <- get_publications(id, cstart = 0, pagesize = 100, flush = FALSE) -pub <- as.character(art$pubid[1]) - -art_dat <- get_article_cite_history(id, pub) -art_dat$year <- as.Date(paste(art_dat$year, 1, 1, sep="-")) - -art_dat$cumcites <- cumsum(art_dat$cites) - -bplot <- ggplot(data=art_dat, aes(x=year, y=cumcites)) + - geom_bar(stat='identity') + - theme_bw(base_size=14) + - theme(panel.grid=element_blank()) + - labs(y="Total citations", x="Year") - - - -art_dat_line <- art_dat[-nrow(art_dat),] -lplot <- ggplot(data=art_dat_line, aes(x=year, y=cites)) + - geom_line() + - geom_point() + - theme_bw(base_size=14) + - theme(panel.grid=element_blank()) + - labs(y="Citations per year", x="Year") - - - - -png("Fig1.png", height=7, width=7, units='in', res=300) -plot_grid(bplot, lplot, nrow=2) -dev.off() - - |