This file contains hidden or 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
--- | |
title: 'Exploring #SOTEU speeches' | |
author: "Giorgio Comai (OBC Transeuropa/#edjnet)" | |
date: "13 September 2017" | |
output: | |
html_document: | |
code_folding: hide | |
theme: readable | |
--- |
This file contains hidden or 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
sudo dnf install qt-devel hunspell-devel qt5-qtwebkit-devel qt5-qtsvg-devel qt5-qtsvg-devel qt5-qtmultimedia-devel qt5-qtbase qt5-linguist qt5-qtwebengine-devel | |
wget https://github.com/wereturtle/ghostwriter/archive/v1.8.0.tar.gz | |
tar -xvzf v1.8.0.tar.gz | |
cd ghostwriter-1.8.0/ | |
/usr/lib64/qt5/bin/qmake-qt5 |
This file contains hidden or 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
## Install castarter (devtools required for installing from github) | |
# install.packages("devtools") | |
devtools::install_github(repo = "giocomai/castarter", ref = "development") | |
setwd("~/R") | |
## Load castarter | |
library("castarter") | |
## Set project and website name | |
SetCastarter(project = "EuropeanUnion", website = "EuropeanCommission") |
This file contains hidden or 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
## Install castarter (devtools required for installing from github) | |
# install.packages("devtools") | |
devtools::install_github(repo = "giocomai/castarter", ref = "development") | |
setwd("~/R") | |
## Load castarter | |
library("castarter") | |
## Set project and website name | |
SetCastarter(project = "EuropeanUnion", website = "EuropeanCommission") |
This file contains hidden or 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
if (!require("pacman")) install.packages("pacman") # for taking care of package installation/loading | |
pacman::p_load("tidyverse") | |
pacman::p_load("ROAuth") | |
pacman::p_load("rtweet") | |
# this assumes authentication has been taken care of as explained here: http://rtweet.info/articles/auth.html | |
# it should still work, but without access tokens the limits for API requests are much slower (it would take *a lot* longer to get all tweets) | |
# it is expected that this script will need to be run more than once | |
# interim files are automatically stored and recovered if the script is re-run |
This file contains hidden or 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
--- | |
title: "Exploring Putin's annual news conference" | |
author: "Giorgio Comai" | |
date: '2017-12-15' | |
--- | |
```{r setup, include=FALSE, echo=TRUE, message=FALSE} | |
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE) |
This file contains hidden or 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
library("geofacet") | |
library("ggplot2") | |
library("tidyverse") | |
library("scales") | |
library("readxl") | |
# dati ripuliti: https://data.world/sapomnia/elezioni-2018/workspace/file?filename=Risultati%20elezioni%20camera%202018%20livello%20comunale.xlsx | |
# basato su: https://github.com/ondata/elezionipolitiche2018 | |
comune <- readxl::read_excel("Risultati elezioni camera 2018 livello comunale.xlsx") |
This file contains hidden or 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
--- | |
title: "Birth age gap" | |
author: "Giorgio Comai" | |
date: "7 August 2018" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) |
This file contains hidden or 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
# load libraries | |
library("gganimate") | |
library("tidyverse") | |
# introduce data | |
structure(list(id = c("Barroso\n2010", "Barroso\n2010", "Barroso\n2010", | |
"Barroso\n2011", "Barroso\n2011", "Barroso\n2011", "Barroso\n2012", | |
"Barroso\n2012", "Barroso\n2012", "Barroso\n2013", "Barroso\n2013", |
This file contains hidden or 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
if (!require("pacman")) install.packages("pacman") | |
pacman::p_load("jsonlite") | |
pacman::p_load("tidyverse") | |
#https://www.datacommons.org/docs/download.html | |
text <- readLines(con = "fact_checks_20180502.txt") | |
text <- stringr::str_remove_all(string = text, pattern = stringr::fixed('<script type=\"application/ld+json\">')) | |
text <- stringr::str_remove_all(string = text, pattern = stringr::fixed("</script>")) | |
txtList <- purrr::map(.x = text, .f = fromJSON, simplifyDataFrame = TRUE, flatten = TRUE) |