Skip to content

Instantly share code, notes, and snippets.

@dgraziotin
Last active June 18, 2017 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgraziotin/ddc4f391313e49ce03d84e057c7f7083 to your computer and use it in GitHub Desktop.
Save dgraziotin/ddc4f391313e49ce03d84e057c7f7083 to your computer and use it in GitHub Desktop.
Timeline of Peer Review history
if(!require(dplyr)) {
install.packages("dplyr", dependencies = T)
}
if (!require("devtools")){
install.packages("devtools")
}
require(devtools)
if (!require(timevis)) {
devtools::install_github("daattali/timevis")
}
if (!require(shiny)) {
install.packages("shiny", dependencies = T)
}
require(dplyr)
require(timevis)
library(shiny)
rerank <- function(pr.timeline.df, orderGroups = FALSE) {
pr.timeline.df$Id <-
rank(pr.timeline.df$Id, ties.method = "first")
if (orderGroups) {
pr.timeline.df$GroupId <- dense_rank(pr.timeline.df$GroupId)
}
return(pr.timeline.df)
}
timeline <- function(pr.timeline.df, orderGroups = FALSE) {
pr.timeline.df <- rerank(pr.timeline.df, orderGroups)
pr.timeline <- data.frame(
id = 1:max(pr.timeline.df$Id),
content = pr.timeline.df$Event,
start = pr.timeline.df$Date,
end = rep(NA, max(pr.timeline.df$Id)),
type = rep("box", max(pr.timeline.df$Id)),
group = pr.timeline.df$GroupId,
groups = pr.timeline.df$Group,
style = rep(
"color: white;background-color:#f2673c; border:0;",
NROW(pr.timeline.df)
)
)
groups <- data.frame(id = pr.timeline.df$GroupId,
content = pr.timeline.df$Group)
groups <- distinct(groups[order(groups$id),])
return(timevis(
pr.timeline,
groups = data.frame(id = groups$id,
content = groups$content,
title = groups$content),
fit = TRUE,
showZoom = TRUE,
options = list(
showCurrentTime = FALSE,
orientation = "top",
editable = FALSE,
min = "1550",
max = "2150"
)
))
}
pr.timeline.data <- read.csv2("./timeline-peerreview.csv")
colnames(pr.timeline.data) <- c("Id", "Event", "Date", "Group", "GroupId")
pr.timeline.viz <- timeline(pr.timeline.data, TRUE)
pr.timeline.viz.1665.1967 <- timeline(subset(pr.timeline.data, pr.timeline.data$Date <= 1967), TRUE)
pr.timeline.viz.1968.2009 <- timeline(subset(pr.timeline.data, pr.timeline.data$Date > 1967 & pr.timeline.data$Date <= 2009), TRUE)
pr.timeline.viz.2010.2017 <- timeline(subset(pr.timeline.data, pr.timeline.data$Date > 2009 & pr.timeline.data$Date <= 2017), TRUE)
ui <- fluidPage(
title = "A timeline of peer review",
tags$head(tags$style(
HTML(
"
.vis-panel.vis-bottom, .vis-panel.vis-center, .vis-panel.vis-left, .vis-panel.vis-right, .vis-panel.vis-top {
border: 1px solid #ccc;
}
div.vis-item.vis-dot {
background-color:#333;
border-color:#f2673c;
}
div.vis-item.vis-line {
border-color:#666;
}
div.vis-inner {
color:#333;
}
.vis-text {
color:#333 !important;
font-weight: bold !important;
}
"
)
)),
div(
id = "header",
div(
"A brief timeline of the evolution of peer review: complete dataset. Scroll down for zoomed timelines."
)
),
mainPanel(id = "prtimelineviz",
timevisOutput(outputId = 'prtimelineviz'),
width = 12),
div(
"A brief timeline of the evolution of peer review: The primordial times 1665-1967."
),
mainPanel(id = "prtimelineviz16651967",
timevisOutput(outputId = 'prtimelineviz16651967'),
width = 12),
div(
"A brief timeline of the evolution of peer review: The revolution 1968-2009."
),
mainPanel(id = "prtimelineviz19682009",
timevisOutput(outputId = 'prtimelineviz19682009'),
width = 12),
div(
"A brief timeline of the evolution of peer review: The revolution 2010-2017"
),
mainPanel(id = "prtimelineviz20102017",
timevisOutput(outputId = 'prtimelineviz20102017'),
width = 12)
)
server <- function(input, output, session) {
output$prtimelineviz <- renderTimevis({
pr.timeline.viz
})
output$prtimelineviz16651967 <- renderTimevis({
pr.timeline.viz.1665.1967
})
output$prtimelineviz19682009 <- renderTimevis({
pr.timeline.viz.1968.2009
})
output$prtimelineviz20102017 <- renderTimevis({
pr.timeline.viz.2010.2017
})
}
shinyApp(ui = ui, server = server)
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Id;Event;Date;Group;GroupId 1;"Journal des S&ccedil;avans 1st issue";1665;Primordial pre publication;1 2;Philosophical Transactions 1st issue;1665;Primordial pre publication;1 3;Royal Society of Edinburgh introduces society members' peer review;1731;Primordial pre publication;1 4;Nature introduces peer review;1967;Pre publication;2 5;arXiv launches;1991;Open peer review facilitator;3 6;BioMed Central publishes reviewer names;2000;Pre publication open;4 7;Atmospheric Chemistry and Physics introduces public peer review;2001;Pre and post publication open;5 8;Wikipedia launches;2001;Open peer review facilitator;3 9;Nature public peer review trial;2006;Pre publication open;4 10;PLOS introduces public comments to articles;2009;Post publication open;6 11;Hypothes.is launches;2011;Decoupled post publication open;7 12;F1000Research launches;2012;Post publication open;6 13;Peerage of Science launches;2012;Decoupled pre publication;9 14;PeerJ launches;2012;Pre and post publication optionally open;10 15;Publons launches;2012;Service recognition;8 16;PubPeer launches;2012;Decoupled post publication open;7 17;RUBRIQ launches;2012;Decoupled pre publication;9 18;Axios Review launches;2013;Decoupled pre publication;9 19;Pubmed Commons launches;2013;Post publication open;6 20;ScienceOpen launches;2013;Post publication open;6 21;PaperHive launches;2014;Decoupled post publication open;7 22;The Winnower launches;2014;Optional post publication open;11 23;PubPub launches;2015;Optional post publication open;11 24;RIO launches;2015;Optional pre and post publication open;12 25;ScienceOpen introduces peer review by endorsement;2015;Optional pre publication open;13 26;Peer Reviewers' Openness Initiative launches;2016;Policy;14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment