Skip to content

Instantly share code, notes, and snippets.

View tts's full-sized avatar

Tuija Sonkkila tts

View GitHub Profile
@tts
tts / draw_grid.R
Created June 2, 2017 13:18
Changes from 2016 to 2017 in citations and altmetrics of some Aalto University publications by School
# https://blog.dominodatalab.com/visualizing-homeownership-in-the-us-using-small-multiples-and-r/
opts <- theme(
panel.background = element_rect(fill="white"),
panel.border = element_rect(colour="black", fill=NA),
axis.line = element_blank(),
axis.ticks = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text = element_text(colour="gray25", size=15, angle=90, hjust=1),
axis.title = element_blank(),
@tts
tts / oadoidata_to_flare_json.R
Created November 25, 2016 12:10
Some metadata and URL of full-text OA articles by source type returned by oadoi.org
library(purrr)
library(tidyr)
library(dplyr)
library(jsonlite)
# Data queried via oadoi.org API with the roadoi package. Title from local CRIS, joined with DOI.
# See https://users.aalto.fi/~sonkkila/oadoi.html
data <- read.csv(file = "repo_and_oadoi.csv", stringsAsFactors = F)
oa <- data[!is.na(data$free_fulltext_url), c("title", "evidence", "free_fulltext_url")]
@tts
tts / app.R
Last active November 21, 2016 08:34
Shiny web app on the CRIS project emails
library(shiny)
library(highcharter)
library(dygraphs)
library(xts)
library(dplyr)
shinyApp(
ui = fluidPage(
fluidRow(
column(12,
@tts
tts / springerLODconf.sq
Last active November 10, 2016 14:03
SPARQL query for searching Springer Computer Science conferences not indexed by Scopus (see http://lod.springer.com/wiki/bin/view/Linked+Open+Data/About)
PREFIX spr-p: <http://lod.springer.com/data/ontology/property/>
PREFIX spr-c: <http://lod.springer.com/data/ontology/class/>
SELECT ?volume ?title ?subtitle ?acronym ?isbn ?eisbn ?scopus ?sdate WHERE {
?volume spr-p:hasConference ?conf ;
spr-p:isIndexedByScopus ?scopus ;
spr-p:title ?title ;
spr-p:subtitle ?subtitle ;
spr-p:bookSeriesAcronym ?acronym ;
spr-p:ISBN ?isbn ;
@tts
tts / query.R
Created July 8, 2016 09:59
Collect works and bio via ORCID Public API
# Query ACRIS on ORCID IDs. Based on these, fetch works and bio via ORCID Public API
#
# SQL query in Pure and save in CSV: SELECT firstname, lastname, orcid FROM PERSON WHERE orcid IS NOT NULL
# Change character set: iconv -f ISO-8859-1 -t UTF-8 orcidinpure.csv > orcidinpure_utf8.csv
#
# Tuija Sonkkila 7.7.2016
library(rorcid)
@tts
tts / emigration.r
Last active June 13, 2016 08:10
Finnish emigration 1900-1945 as a sankey diagram
# See http://tuijasonkkila.fi/blog/2016/06/a-finnish-alien/
library(dplyr)
library(tidyr)
library(XLConnect)
download.file("http://www.siirtolaisuusinstituutti.fi/files/xls/maahan-_ja_maastamuutto/siirtolaisuus_1870-1945.xls",
"data.xls")
# Exclude years before 1900, and the last colum Total (Yhteensä)
sheet <- readWorksheetFromFile("data.xls", sheet="Taulukko", startRow=35, endRow=80, endCol=12, header=F)
@tts
tts / global.R
Last active December 19, 2015 14:49
Altmetric Top100 2015 data as an R Shiny web app
library(dplyr)
library(XLConnect)
library(shiny)
library(shinydashboard)
library(d3heatmap)
# See https://ttso.shinyapps.io/altm2015top100
# Read in Altmetric data and merge affiliation data with ID
wb <- loadWorkbook("altmetrictop1002015.xlsx")
@tts
tts / query.R
Last active November 22, 2015 13:53
Most discussed articles on diabetes in 2015
library(RCurl)
library(rAltmetric)
library(dplyr)
# Which articles on diabetes, published in 2015, are among the most discussed based on Altmetric.com data?
# See http://tuijasonkkila.fi/blog/2015/11/diabetes/
# http://www.fredtrotter.com/2014/11/14/hacking-on-the-pubmed-api/
baseurl <- "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&retmax=1000&term="
@tts
tts / europe.geojson
Last active December 5, 2015 10:35
Primate fossil finds in Europe
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tts
tts / finland.geojson
Created November 13, 2015 12:46
Mercator projection map of Finland
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.