Skip to content

Instantly share code, notes, and snippets.

View tklebel's full-sized avatar

Thomas Klebel tklebel

View GitHub Profile
library(tidyverse)
df <- read_csv("~\\NPL_DOI_FOS.csv")
df_restructured <- df %>%
select(doi, matches("fos_\\d_name$")) %>%
group_by(doi) %>%
mutate(id = seq_along(doi)) %>%
pivot_longer(starts_with("fos")) %>%
filter(!is.na(value)) %>%
@tklebel
tklebel / query_crossref_for_springer_nature.R
Last active October 14, 2019 06:57
Query Crossref for journals from SpringerNature
library(tidyverse)
library(rcrossref)
# determine the maximum number of records that will be retrieved
initial_res <- cr_members(member_ids = 297, works = T,
filter = list(type = "journal"), limit = 1)
# query all of them
res <- cr_members(member_ids = 297, works = T,
# save test result as object
test_res <- t.test(examgrades$MeanGrade ~ examgrades$Semester)
# extract t and p values and format them
label <- paste(paste("t =", round(test_res$statistic, 2)),
paste("p =", format.pval(test_res$p.value, eps = .001)),
sep = ", ")
# add text with t-test result to figure
q1 <- q + annotate("text", x = 1, y = 85, label = label, size = 8)
@tklebel
tklebel / graph.R
Created August 17, 2015 12:33
Recreating graph from simulation study with ggplot
### cpd beta1 Coverage
# hinzufügen zu Zeile 335 (ca)
library(ggplot2)
df <- as.data.frame(cpd.coverB1)
ggplot(df, aes(cpd.coverB1, fill = cpd.coverB1)) +
geom_bar() +
geom_hline(yintercept = 950, linetype = 'dashed', colour = "blue") +
ylim(c(0, 1000)) +