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
git clone git@github.com:craigcabrey/luminance.git | |
cd luminance | |
pip3 install requests | |
pip3 install netdisco | |
sudo dnf install gsettings-desktop-schemas gsettings-desktop-schemas-devel pygobject3-devel gtk3-devel | |
sudo pip3 install phue | |
./autogen.sh | |
./configure |
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
library("tabulizer") | |
library("tidyverse") | |
dir.create("data", showWarnings = FALSE) | |
dir.create(file.path("data", "original_files"), showWarnings = FALSE) | |
census_2011_pdf_url <- "https://www.armstat.am/file/article/1._bajin_1_182-311.pdf" | |
census_2011_pdf_file <- file.path("data", "original_files", "census_2011.pdf") | |
if (file.exists(census_2011_pdf_file)==FALSE) { |
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
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) |
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
# 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 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 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 udunits2 udunits2-devel | |
install.packages("udunits2", configure.args = c(udunits2 = '--with-udunits2-include=/usr/include/udunits2')) |
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
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 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 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 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") |