Skip to content

Instantly share code, notes, and snippets.

Avatar

Tuija Sonkkila tts

View GitHub Profile
View rtnetworkwithtweets.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tts
tts / 2019altmTop100aff.R
Created Dec 19, 2019
2019 Altmetric Top 100 geocoded affiliations on world map
View 2019altmTop100aff.R
library(tidyverse)
library(readxl)
library(tmaptools)
library(maps)
library(sf)
url <- "https://altmetric.figshare.com/ndownloader/files/20202618"
temp <- tempfile()
download.file(url, temp)
data <- read_excel(temp)
View hkitrees_viz.R
library(tidyverse)
library(sf)
# Data from hri.fi
districts <- st_read("PKS_Kartta_Rajat_KML2011/PKS_suuralue.kml")
hki <- districts %>%
filter(Name %in% c("Eteläinen", "Itäinen","Läntinen","Kaakkoinen",
"Keskinen","Pohjoinen","Koillinen")) %>%
mutate(Name_en = case_when(
@tts
tts / energy.R
Last active Jan 20, 2019
Line graph on energy production in district heating of the Helsinki capital area
View energy.R
library(tidyverse)
library(readxl)
library(httr)
#-------------------------------------------------------------
# hri.fi
#
# Pääkaupunkiseudun kaukolämmön tuotannon energialähteet (GWh)
#-------------------------------------------------------------
@tts
tts / addMissingYears.vb
Last active Jul 11, 2017
Transform Pure activities data by filling in rows with missing year
View addMissingYears.vb
Public Sub addMissingYears()
Dim readFrom As Long 'Row we read from
Dim writeTo As Long 'Row we write to
Dim allRows As Long 'Row count to loop over
Dim thisC As Long
Dim thisD As Long
Dim sheetFrom As Worksheet 'Sheet where we read from
Dim sheetTo As Worksheet 'Sheet where we write to
@tts
tts / pure2powerbi.R
Last active Jul 10, 2017
Transform Pure activities data exported as Excel to be imported into Power BI for reporting
View pure2powerbi.R
# `dataset` holds the input data for this script
library(dplyr)
names(dataset) <- c("Type", "Unit", "Start", "End")
dataset$Unit <- iconv(dataset$Unit, from = "WINDOWS-1252", to = "UTF-8")
# We need to expand those rows where Start and End span more than one year,
# e.g. 2010-2012 into 2010, 2011, 2012
to_expand <- dataset %>%
View changes_metrics_small_multiples.R
library(dplyr)
library(tidyr)
library(ggplot2)
library(gridExtra)
library(grid)
data20162017 <- read.csv("toshiny_altm_2016_2017.csv", stringsAsFactors = FALSE)
data20162017 <- data20162017 %>%
mutate(gap_cites = Citations2017 - Citations,
@tts
tts / draw_grid.R
Created Jun 2, 2017
Changes from 2016 to 2017 in citations and altmetrics of some Aalto University publications by School
View draw_grid.R
# 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 Nov 25, 2016
Some metadata and URL of full-text OA articles by source type returned by oadoi.org
View oadoidata_to_flare_json.R
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 Nov 21, 2016
Shiny web app on the CRIS project emails
View app.R
library(shiny)
library(highcharter)
library(dygraphs)
library(xts)
library(dplyr)
shinyApp(
ui = fluidPage(
fluidRow(
column(12,
You can’t perform that action at this time.