Skip to content

Instantly share code, notes, and snippets.

@njahn82
njahn82 / hoad_dash_beispiel.md
Created November 15, 2021 11:18
hoad_dash_beispiel
View hoad_dash_beispiel.md
library(tidyverse)
library(bigrquery)
library(DBI)

Connection

@njahn82
njahn82 / doi_check.md
Created September 9, 2021 13:21
doi check
View doi_check.md
library(tidyverse)
#> Warning: package 'tibble' was built under R version 4.1.1
#> Warning: package 'readr' was built under R version 4.1.1
library(biblids) # install via GitHub https://github.com/subugoe/biblids

tt <- readr::read_csv("~/Downloads/DOIs.txt")
#> Rows: 40479 Columns: 1
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
@njahn82
njahn82 / mag_subject.md
Created July 27, 2021 07:52
mag subjects
View mag_subject.md
library(tidyverse)
# raw subject table
subject_mag_raw <- readr::read_csv("data/NPL_DOI_FOS.csv",
  col_types =  cols(.default = "c"))
subject_mag_raw %>%
  # Represents https://academic.microsoft.com/paper/2518129109/
  filter(doi == "10.7717/peerj.2369") %>%
  # Only top level subjects
  filter(is.na(fos_1)) %>%
@njahn82
njahn82 / esac.md
Created March 30, 2021 14:16
Fetch ESAC registry info
View esac.md
library(rvest)
library(tidyverse)
library(janitor)
#> 
#> Attaching package: 'janitor'
#> The following objects are masked from 'package:stats':
#> 
#>     chisq.test, fisher.test
esac <-
@njahn82
njahn82 / reprex.md
Created March 4, 2021 15:14
reprex_doi_validation
View reprex.md
library(rcrossref)
library(purrr)

my_dois <-
  c(
    "skksks",
    "10.5281/zenodo.4032609",
    "10.1667/rr13708.1",
    "10.1016/s0021-9258(19)52311-0",
@njahn82
njahn82 / open_apc.R
Created February 12, 2021 11:32
Open APC R helper
View open_apc.R
#' Get most current Open APC snapshot
#'
#' Open APC shares several csv files via GitHub, which contain data about
#' institutional spending for open access articles.
#'
#'
#' @param open_apc_cols character vector representing Open APC collections.
#' See `open_apc_collections()` for an overview.
#'
#' @importFrom dplyr filter `%>%` inner_join
@njahn82
njahn82 / vanished_with_r.md
Created September 16, 2020 07:45
vanished example
View vanished_with_r.md
# import csv file
tt <- read.delim("~/Downloads/vanished_v2.csv", sep = ";")
# table dimensions
dim(tt)
#> [1] 807  61
# empty rows at bottom like row 635
tt[635,]
#>     Source If.Identified.by.second.source Journal.Name ISSN E.ISSN URL
#> 635                                                                   
@njahn82
njahn82 / ci_wos.R
Created August 12, 2020 10:23
C1 WOS
View ci_wos.R
library(tidyverse)
my_df <- readr::read_csv("data/u4_13_17.csv")
no_group <- my_df %>%
filter(is.na(CA))
no_group %>%
select(PY, UT, C1) %>%
mutate(adresses = strsplit(C1, "; \\[")) -> tt
tt %>%
unnest() %>%
tidyr::separate(adresses, sep ="] ", c("authors", "address"), fill = "left") %>%
View epmc_covid.md
library(europepmc)
library(tidyverse)
library(cowplot)
#> 
#> ********************************************************
#> Note: As of version 1.0.0, cowplot does not change the
#>   default ggplot2 theme anymore. To recover the previous
#>   behavior, execute:
#>   theme_set(theme_cowplot())
@njahn82
njahn82 / wp_1_2.Rmd
Last active March 3, 2020 15:34
wp 1.2 hoad
View wp_1_2.Rmd
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
warning = FALSE,
message = FALSE