Last active
December 25, 2015 14:19
-
-
Save tts/6990101 to your computer and use it in GitHub Desktop.
An interactive R Shiny web application with some sample data of various altmetrics from Aalto University publications 2007-2012 with a DOI in Thomson Reuters Web of Data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doi | url | details_url | year | wos | score | mendeley | connotea | citeulike | readers_count | cited_by_gplus_count | cited_by_fbwalls_count | cited_by_posts_count | cited_by_tweeters_count | cited_by_accounts_count | cited_by_feeds_count | cited_by_videos_count | cited_by_msm_count | delicious_bookmarks | plosalm_html_views | plosalm_pdf_views | plosalm_scopus | pmc_citations | topsy_tweets | CrossRef | Nature | PubMed | F1000 | Figshare | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 10.1002/adfm.201102827 | http://onlinelibrary.wiley.com/doi/10.1002/adfm.201102827/suppinfo | http://www.altmetric.com/details.php?citation_id=704569 | 2012 | 4 | 11 | 10 | 0 | 0 | 10 | NA | NA | 2 | 1 | 2 | NA | NA | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
2 | 10.1002/adma.201100461 | http://dx.doi.org/doi:10.1002/adma.201100461 | http://www.altmetric.com/details.php?citation_id=211781 | 2011 | 20 | 9.25 | 19 | 0 | 0 | 19 | NA | NA | 3 | NA | 2 | 1 | 1 | NA | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
3 | 10.1002/adma.201101888 | http://onlinelibrary.wiley.com/resolve/doi?DOI=10.1002/adma.201101888 | http://www.altmetric.com/details.php?citation_id=240542 | 2011 | 17 | 0.25 | 22 | 0 | 2 | 24 | NA | NA | 1 | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
4 | 10.1002/adma.201103111 | http://dx.doi.org/10.1002/adma.201103111 | http://www.altmetric.com/details.php?citation_id=437073 | 2011 | 7 | 10.25 | 5 | 0 | 0 | 5 | NA | NA | 2 | 1 | 2 | NA | NA | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
5 | 10.1002/adma.201103131 | http://onlinelibrary.wiley.com/resolve/doi?DOI=10.1002/adma.201103131 | http://www.altmetric.com/details.php?citation_id=419722 | 2011 | 5 | 0.25 | 22 | 0 | 0 | 22 | NA | NA | 1 | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
6 | 10.1002/adma.201200501 | http://onlinelibrary.wiley.com/doi/10.1002/adma.201200501/abstract;jsessionid=DFC15A87A20C99D19DB8955364B0FFB8.d01t04 | http://www.altmetric.com/details.php?citation_id=743967 | 2012 | 0 | 16.742 | 12 | 0 | 0 | 12 | NA | 1 | 6 | 3 | 6 | 1 | NA | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
7 | 10.1002/adma.201200931 | http://doi.wiley.com/10.1002/adma.201200931 | http://www.altmetric.com/details.php?citation_id=1506819 | 2012 | 10 | 8 | 2 | 0 | 0 | 2 | NA | NA | 1 | NA | 1 | NA | NA | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
8 | 10.1002/adma.201202980 | http://dx.doi.org/doi:10.1002/adma.201202980 | http://www.altmetric.com/details.php?citation_id=934084 | 2012 | 4 | 61.992 | 11 | 0 | 0 | 11 | 3 | 1 | 36 | 20 | 32 | 3 | 2 | 2 | NA | NA | NA | NA | NA | 1 | NA | NA | NA | NA | NA | |
9 | 10.1002/adma.201204060 | http://dx.doi.org/10.1002/adma.201204060 | http://www.altmetric.com/details.php?citation_id=1521259 | 2012 | 3 | 8 | 4 | 0 | 0 | 4 | NA | NA | 1 | NA | 1 | NA | NA | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
10 | 10.1002/anie.201102973 | http://dx.doi.org/doi:10.1002/anie.201102973 | http://www.altmetric.com/details.php?citation_id=206772 | 2011 | 20 | 11.5 | 23 | 0 | 0 | 23 | NA | NA | 4 | 2 | 3 | 1 | NA | NA | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
11 | 10.1002/anie.201200946 | http://onlinelibrary.wiley.com/resolve/doi?DOI=10.1002/anie.201200946 | http://www.altmetric.com/details.php?citation_id=663888 | 2012 | 1 | 11.25 | 8 | 0 | 0 | 8 | NA | NA | 2 | 1 | 2 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
12 | 10.1002/app.36787 | http://doi.wiley.com/10.1002/app.36787 | http://www.altmetric.com/details.php?citation_id=1506799 | 2012 | 4 | 8 | 0 | 0 | 0 | 0 | NA | NA | 1 | NA | 1 | NA | NA | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
13 | 10.1002/asi.21596 | http://onlinelibrary.wiley.com/resolve/doi?DOI=10.1002/asi.21596 | http://www.altmetric.com/details.php?citation_id=386405 | 2011 | 1 | 1 | 0 | 0 | 0 | 0 | NA | NA | 1 | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | 1 | NA | NA | NA | NA | NA | |
14 | 10.1002/asi.21643 | http://onlinelibrary.wiley.com/doi/10.1002/asi.21643/abstract | http://www.altmetric.com/details.php?citation_id=381820 | 2011 | 0 | 2.85 | 3 | 0 | 1 | 4 | NA | NA | 1 | 4 | 4 | NA | NA | NA | 1 | NA | NA | NA | NA | 2 | NA | NA | NA | NA | NA | |
15 | 10.1002/bse.744 | http://onlinelibrary.wiley.com/doi/10.1002/bse.744/full | http://www.altmetric.com/details.php?citation_id=496951 | 2012 | 1 | 0.5 | 0 | 0 | 0 | 0 | NA | NA | 1 | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
16 | 10.1002/er.1905 | http://onlinelibrary.wiley.com/resolve/doi?DOI=10.1002/er.1905 | http://www.altmetric.com/details.php?citation_id=386805 | 2011 | 1 | 1 | 0 | 0 | 0 | 0 | NA | NA | 1 | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
17 | 10.1002/hbm.21105 | http://onlinelibrary.wiley.com/doi/10.1002/hbm.21105/abstract?deniedAccessCustomisedMessage=&userIsAuthenticated=false | http://www.altmetric.com/details.php?citation_id=853225 | 2011 | 5 | 1.25 | 26 | 0 | 0 | 26 | NA | NA | 2 | 2 | 2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
18 | 10.1002/hbm.21237 | http://onlinelibrary.wiley.com/doi/10.1002/hbm.21237/abstract | http://www.altmetric.com/details.php?citation_id=595676 | 2012 | 9 | 0.85 | 16 | 0 | 0 | 16 | NA | NA | 4 | 4 | 4 | NA | NA | NA | NA | NA | NA | NA | NA | 4 | NA | NA | NA | NA | NA | |
19 | 10.1002/hrm.21478 | http://onlinelibrary.wiley.com/doi/10.1002/hrm.21478/abstract;jsessionid=269FF91448EC50A998F53790D56BE959.d03t02?systemMessage=Wiley+Online+Library+will+be+disrupted+on+26+May+from+10%3A00-12%3A00+BST+%2805%3A00-07%3A00+EDT%29+for+essential+maintenance | http://www.altmetric.com/details.php?citation_id=762396 | 2012 | 0 | 0.5 | 2 | 0 | 0 | 2 | NA | NA | 1 | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
20 | 10.1002/mabi.201100198 | http://dx.doi.org/10.1002%2Fmabi.201100198?utm_source=dlvr.it&utm_medium=twitter | http://www.altmetric.com/details.php?citation_id=441499 | 2011 | 1 | 0.25 | 4 | 0 | 0 | 4 | NA | NA | 1 | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
21 | 10.1002/nme.3233 | http://onlinelibrary.wiley.com/resolve/doi?DOI=10.1002/nme.3233 | http://www.altmetric.com/details.php?citation_id=193486 | 2012 | 1 | 1.5 | 0 | 0 | 1 | 1 | NA | NA | 2 | 2 | 2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
22 | 10.1002/path.4027 | http://onlinelibrary.wiley.com/resolve/doi?DOI=10.1002%2Fpath.4027 | http://www.altmetric.com/details.php?citation_id=725485 | 2012 | 1 | 2.1 | 4 | 0 | 0 | 4 | NA | NA | 3 | 3 | 3 | NA | NA | NA | NA | NA | NA | NA | NA | 1 | NA | NA | NA | NA | NA | |
23 | 10.1002/pssb.201200393 | http://onlinelibrary.wiley.com/doi/10.1002/pssb.201200393/abstract | http://www.altmetric.com/details.php?citation_id=1012254 | 2012 | 2 | 19 | 5 | 0 | 0 | 5 | NA | NA | 4 | 1 | 3 | NA | NA | 1 | NA | NA | NA | NA | NA | 3 | NA | NA | NA | NA | NA | |
24 | 10.1002/pssr.201105350 | http://export.arxiv.org/api/query?id_list=1107.3189 | http://www.altmetric.com/details.php?citation_id=192253 | 2011 | 18 | 0.25 | 14 | 0 | 0 | 14 | NA | NA | 1 | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
25 | 10.1002/rob.20300 | http://onlinelibrary.wiley.com/doi/10.1002/rob.20300/abstract;jsessionid=CE8CDB4AB8EF00BB2A63195CDF941EFC.d03t02 | http://www.altmetric.com/details.php?citation_id=1224053 | 2009 | 10 | 0.25 | 5 | 0 | 0 | 5 | NA | NA | 1 | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
26 | 10.1002/smj.1963 | http://onlinelibrary.wiley.com/doi/10.1002/smj.1963/abstract | http://www.altmetric.com/details.php?citation_id=606621 | 2012 | 0 | 2.5 | 0 | 0 | 1 | 1 | NA | NA | 1 | 3 | 3 | NA | NA | NA | NA | NA | NA | NA | NA | 2 | NA | NA | NA | NA | NA | |
27 | 10.1002/smr.566 | http://onlinelibrary.wiley.com/resolve/doi?DOI=10.1002/smr.566 | http://www.altmetric.com/details.php?citation_id=432027 | 2012 | 0 | 0.5 | 0 | 0 | 0 | 0 | NA | NA | 1 | 1 | 1 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | |
28 | 10.1002/sres.1090 | http://onlinelibrary.wiley.com/doi/10.1002/sres.1090/abstract | http://www.altmetric.com/details.php?citation_id=883588 | 2012 | 1 | 0.25 | 8 | 0 | 1 | 9 | NA | 1 | 1 | NA | 1 | NA | NA | NA | NA | NA | NA | NA | NA | 2 | NA | NA | NA | NA | NA | |
29 | 10.1002/stem.1013 | http://onlinelibrary.wiley.com/resolve/doi?DOI=10.1002/stem.1013 | http://www.altmetric.com/details.php?citation_id=490103 | 2012 | 5 | 1.5 | 7 | 0 | 0 | 7 | NA | NA | 2 | 2 | 2 | NA | NA | NA | 1 | NA | NA | NA | NA | 1 | NA | NA | NA | NA | NA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################################################## | |
# | |
# Altmetrics about Aalto University publications | |
# 2007-2012 as an R Shiny web application | |
# | |
# 2.11.2013 Tuija Sonkkila | |
# | |
# Altmetric data provided by Altmetric.com | |
# ImpactStory data provied by ImpactStory | |
# PLoS ALM data provide by PLoS | |
# Web of Science data provided by Thomson Reuters | |
# | |
# About gathering altmetric data, see https://gist.github.com/tts/7264601 | |
# | |
################################################################################################################# | |
library(shiny) | |
library(rCharts) | |
library(reshape2) | |
aalto_all_m <- read.table(file = "aalto.altm.csv", | |
header = TRUE, | |
sep = ",", | |
col.names = c("id", "DOI", "URL", "Altmetric.com_URL", "Year", | |
"WoS", "Altmetric.com_score", "Mendeley", "Connotea", "CiteULike", | |
"Readers_count", "GooglePlus", "Facebook", "Any_type_of_posts", "Twitter", | |
"Accounts", "Blog_posts", "Videos", "Science_news_outlets", "Delicious_bookmarks", | |
"PLOSalm_html_views", "PLOSalm_pdf_views", "PLOSalm_scopus", "pmc_citations", "Topsy_tweets", | |
"CrossRef", "Nature", "PubMed", "F1000", "Figshare"), | |
colClasses = c("character", "character", "character", "character", "character", | |
"integer", "numeric", "integer", "integer", "integer", | |
"integer", "integer", "integer", "integer", "integer", | |
"integer", "integer", "integer", "integer", "integer", | |
"integer", "integer", "integer", "integer", "integer", | |
"integer", "integer", "integer", "integer", "integer"), | |
stringsAsFactors = FALSE) | |
# Altmetric.com_score value to ceiling (is this way on their web page) | |
aalto_all_m$Altmetric.com_score <- as.integer(ceiling(aalto_all_m$Altmetric.com_score)) | |
# For some reason, the data type of cols from GooglePlus onwards become not integer in import (perhaps because of NA's). So here, again | |
# http://stackoverflow.com/questions/3796266/change-the-class-of-many-columns-in-a-data-frame | |
columns <- c(which(colnames(aalto_all_m) == "GooglePlus"):ncol(aalto_all_m)) | |
aalto_all_m[ ,columns] <- apply(aalto_all_m[ ,columns], 2, function(x) as.integer(as.character(x))) | |
# Reorder | |
aalto_all_m <- aalto_all_m[c("id", "DOI", "URL", "Readers_count", "Accounts", | |
"Altmetric.com_score", "Any_type_of_posts", "Blog_posts", "CiteULike", | |
"Connotea", "CrossRef", "Delicious_bookmarks", "Facebook", "Figshare", "F1000", "GooglePlus", "Mendeley", "Nature", | |
"PLOSalm_html_views", "PLOSalm_pdf_views", "PLOSalm_scopus", "PubMed", | |
"Science_news_outlets", "Topsy_tweets", "Twitter", "WoS", "Videos", | |
"Altmetric.com_URL", "Year")] | |
allmetrics <- c("Altmetric score (ALT)" = "Altmetric.com_score", | |
"Any type of posts (ALT)" = "Any_type_of_posts", | |
"Blog posts (ALT)" = "Blog_posts", | |
"CiteULike (ALT)" = "CiteULike", | |
"Connotea (ALT)" = "Connotea", | |
"CrossRef (PLoS)" = "CrossRef", | |
"Delicious (IS)" = "Delicious_bookmarks", | |
"Facebook (ALT)" = "Facebook", | |
"Figshare (PLoS)" = "Figshare", | |
"F1000 (PLoS)" = "F1000", | |
"Google+ (ALT)" = "GooglePlus", | |
"Mendeley (ALT)" = "Mendeley", | |
"Nature (PLoS)" = "Nature", | |
"PLOS ALM html views (IS)" = "PLOSalm_html_views", | |
"PLOS ALM pdf views (IS)" = "PLOSalm_pdf_views", | |
"PLOS ALM Scopus (IS)" = "PLOSalm_scopus", | |
"PubMed (PLoS)" = "PubMed", | |
"Science news outlets (ALT)" = "Science_news_outlets", | |
"Topsy tweets (IS)" = "Topsy_tweets", | |
"Twitter (ALT)" = "Twitter", | |
"Web of Science" = "WoS", | |
"Videos (ALT)" = "Videos") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################################################## | |
# | |
# Altmetrics about Aalto University publications | |
# 2007-2012 as an R Shiny web application | |
# | |
# 2.11.2013 Tuija Sonkkila | |
# 19.12.2013 Commented code on ImpactStory widgets | |
# | |
# Altmetric data provided by Altmetric.com | |
# ImpactStory data provied by ImpactStory | |
# PLoS ALM data provide by PLoS | |
# Web of Science data provided by Thomson Reuters | |
# | |
# About gathering altmetric data, see https://gist.github.com/tts/7264601 | |
# | |
################################################################################################################# | |
library(shiny) | |
library(rCharts) | |
library(reshape2) | |
shinyServer(function(input, output, session) { | |
# The user picks up one metrics, and based on that, we sort the data frame in descending order, | |
# and show the Top10 | |
tableValues <- reactive({ | |
cols <- head(aalto_all_m[order(aalto_all_m[[input$m]], decreasing = TRUE), ], n = 10) | |
# Show only those cols that are included in the variable vars, plus URL and Year | |
tb <- cols[, c(names(cols) %in% input$vars)] | |
tb$Altmetric.com_URL <- cols$Altmetric.com_URL | |
tb$Year <- cols$Year | |
# The support for ImpactStory badges will cease mid-Jan 2014 | |
# | |
# tb$Widget <- cols$DOI | |
tb | |
}) | |
output$caption <- renderText({ | |
"ALT = Altmetric.com | IS = ImpactStory | PLoS = PLoS ALM" | |
}) | |
output$table <- renderTable({ | |
tb <- tableValues() | |
# About HTML rendering: http://stackoverflow.com/questions/19019709/r-shiny-table-not-rendering-html | |
for (i in 1:nrow(tb)) { | |
url <- substr(tb$Altmetric.com_URL[i], 47, nchar(tb$Altmetric.com_URL[i])) | |
doUrl <- paste("<a href=", tb[i, c("Altmetric.com_URL")], "\" target=\"_blank\">", url, "</a>", sep = "") | |
doBold <- paste("<b><font color=\"red\">", tb[i, c(input$m)], "</font></b>", sep = "") | |
# | |
# The support for ImpactStory badges will cease mid-Jan 2014 | |
# | |
# doBadge <- paste("<span class=\"impactstory-embed\" data-show-logo=\"false\" data-badge-size=\"small\" data-id=\"", | |
# tb[i, c("Widget")], "\" data-id-type=\"doi\" data-api-key=\"sonkkila-aarznq\"></span>", sep = "") | |
tb[i, c("Altmetric.com_URL")] <- doUrl | |
tb[i, c(input$m)] <- doBold | |
# tb[i, c("Widget")] <- doBadge | |
} | |
tb | |
}, include.rownames = FALSE, sanitize.text.function = function(s) s) | |
# sub("Widget", "<script type=\"text/javascript\" | |
# src=\"http://impactstory.org/embed/v1/impactstory.js\"></script>", s)) | |
# Plot a chart based on the values in the table | |
output$chart <- renderChart({ | |
myData <- tableValues() | |
myData[is.na(myData)] <- 0 | |
# Drop a col | |
myData2 <- as.data.frame(lapply(myData[ ,!colnames(myData) %in% c("Year", "Altmetric.com_URL")], as.integer, stringsAsFactors = FALSE)) | |
# t <- "http://www.altmetric.com/details.php?citation_" | |
# nchar(t) # =46 | |
# Make an id string from the rest. Needs to be modified if the URL changes | |
myData2$id <- substr(myData$Altmetric.com_URL, 47, nchar(myData$Altmetric.com_URL)) | |
# Transform data for plotting | |
myDataM <- melt(myData2, id.vars="id") | |
p2 <- nPlot(value ~ id, data = myDataM, group = "variable", type = "multiBarChart") | |
p2$chart(reduceXTicks = FALSE) | |
p2$xAxis(staggerLabels = TRUE) | |
p2$set(dom="chart") | |
return(p2) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################################################## | |
# | |
# Altmetrics about Aalto University publications | |
# 2007-2012 as an R Shiny web application | |
# | |
# 2.11.2013 Tuija Sonkkila | |
# 19.12.2013 Commented code on ImpactStory widgets | |
# | |
# Altmetric data provided by Altmetric.com | |
# ImpactStory data provied by ImpactStory | |
# PLoS ALM data provide by PLoS | |
# Web of Science data provided by Thomson Reuters | |
# | |
# About gathering altmetric data, see https://gist.github.com/tts/7264601 | |
# | |
################################################################################################################# | |
library(shiny) | |
library(rCharts) | |
library(reshape2) | |
shinyUI(pageWithSidebar( | |
headerPanel(paste("Some raw (alt)metrics of Aalto University publications 2007-2012", " (N=", nrow(aalto_all_m), ")", sep = "")), | |
sidebarPanel( | |
h6(textOutput("caption")), | |
selectInput(inputId = "m", | |
label = "Choose Top10 metrics:", | |
choices = allmetrics, | |
selected = c("Altmetric score (ALT)")), | |
checkboxGroupInput(inputId = "vars", | |
label = "Select what to show:", | |
choices = allmetrics, | |
selected = c("Altmetric score (ALT)", | |
"Mendeley (ALT)")) | |
), | |
mainPanel( | |
# The support for ImpactStory badges will cease mid-Jan 2014 | |
# | |
# HTML("<style> | |
# .impactstory-embed.impactstory-small{ | |
# width: 400px; | |
# } | |
# </style>"), | |
tableOutput("table"), | |
br(), | |
showOutput("chart", "nvd3") | |
) | |
)) |
Thank you! You are absolutely right of course.
Note to self (again): start using RStudio properly with the Git version control to avoid mistakes like this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to add
library(reshape2)
to your code. Otherwise, it throws an error stating, it can findmelt
. Nice Shiny app BTW!