Skip to content

Instantly share code, notes, and snippets.

@njahn82
njahn82 / vanished_with_r.md
Created September 16, 2020 07:45
vanished example
# 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
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") %>%
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
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
warning = FALSE,
message = FALSE
@njahn82
njahn82 / example.md
Created February 26, 2020 09:22
Percentile Ranks KB
    select
        pk_items,
        count,
        wos_b_2019.d_percentiles.c_max,
        wos_b_2019.classifications.classification,
        wos_b_2019.items.pubyear,
        wos_b_2019.items.doctype,
        wos_b_2019.items.pubtype,
@njahn82
njahn82 / script.R
Last active December 3, 2019 11:57
Elsevier invoice data check
library(tidyverse)
library(rcrossref)
library(janitor)
library(crminer)
my_dois <- readxl::read_xlsx("dois_elsevier.xlsx") %>%
clean_names()
# call Crossref
cr_df <- cr_works(my_dois$digital_object_identifier_doi, .progress = "text")
# get CC licensed articles
cc_df <- cr_df$data %>%
@njahn82
njahn82 / base_with_r.md
Created October 17, 2019 13:25
BASE example
library(tidyverse)
library(jsonlite)
#> 
#> Attaching package: 'jsonlite'
#> The following object is masked from 'package:purrr':
#> 
#>     flatten
base_df <- jsonlite::stream_in(file("~/Downloads/base_dois.json"), verbose = FALSE)
#> Warning in readLines(con, n = pagesize, encoding = "UTF-8"): incomplete
@njahn82
njahn82 / cr_economics.md
Last active September 11, 2019 10:14
Journal of Applied Econometrics Crossref Example
library(rcrossref)
cr_works(filter = c(
	issn = "1099-1255",
	from_pub_date = "2013-01-01",
	until_pub_date = "2019-12-31",
	type = "journal-article"
    ),
limit = 500)
@njahn82
njahn82 / epm_hits_eg.md
Created August 12, 2019 08:00
Europe PMC hits Example
my_query <-
  '(TITLE:"older adult" or TITLE:elderly) and (TITLE:falls or TITLE:trauma)'
europepmc::epmc_hits_trend(query = my_query,
                           period = 2008:2018,
                           data_src = 'med')
#> # A tibble: 11 x 3
#>     year all_hits query_hits
#>    <int>    <dbl>      <dbl>
#&gt; 1 2008 761217 72
library(tidyverse)
library(rcrossref)
library(roadoi)

Load data