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
################################################################################ | |
# | |
# ikashnitsky.github.io 2017-07-18 | |
# Accessing Eurostat data using the `eurostat` R package | |
# Young people neither in employment nor in education and training in Europe | |
# Ilya Kashnitsky, [email protected] | |
# | |
################################################################################ | |
# Erase all objects in memory |
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(MASS) | |
library(rio) | |
library(tidyverse) | |
multhet <- function(y, ## = formula(1~1), | |
v, ## = formula(~1), | |
data) { | |
## check length of inputs | |
if (class(y) != "formula") { |
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
# You won't need all of these packages. I just copied it from another,related analysis: | |
# https://github.com/svmiller/etjc | |
library(car) | |
library(arm) | |
library(countrycode) | |
library(data.table) | |
library(tidyverse) | |
library(sqldf) | |
# library(pdftools) |
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(magrittr) | |
library(magick) | |
image_read("logo:") %>% | |
image_convert('png', colorspace = 'gray') %>% | |
image_edge(radius = 1) %>% | |
image_negate() %>% | |
image_transparent('white', 10000) %>% | |
image_background("white") %>% | |
image_browse() |
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
/* | |
Create a userChrome.css file by finding your Firefox profile, | |
making a directory called chrome and in it, a file called userChrome.css inside that. | |
Pasting this CSS and restarting Firefox will kill the left drag strip | |
*/ | |
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); | |
.titlebar-placeholder[type="pre-tabs"] { | |
width: 2px !important; |
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(segmented) | |
library(tidyverse) | |
dat <- structure(list(Pollster = structure(c(2L, 2L, 2L, 2L, 2L, 2L, | |
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, | |
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, | |
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Poll by gfk", | |
"Poll by YouGov"), class = "factor"), Fieldwork.end.date = structure(c(17539, | |
17520, 17511, 17505, 17478, 17463, 17459, 17458, 17450, 17433, | |
17409, 17400, 17379, 17366, 17358, 17339, 17330, 17324, 17317, |
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(rvest) | |
library(lubridate) | |
library(tidyverse) | |
Truman <- read_html("http://www.presidency.ucsb.edu/data/popularity.php?pres=33") | |
Truman %>% | |
html_table(fill=T) -> Truman | |
Truman[[11]] -> Truman |
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: "World maps" | |
output: | |
html_document: | |
df_print: paged | |
--- | |
```{r echo = FALSE, message = FALSE} | |
library(tidyverse) | |
library(sf) |
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 package | |
library(ggplot2) | |
# write function | |
label_facets <- function(string){ | |
len <- length(string) | |
string = paste('(', letters[1:len], ') ', string, sep = '') | |
return(string) | |
} |
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(tidyverse) | |
library(patchwork) | |
plot_pair <- function(data, x, y) { | |
ggplot(data, aes_string(x = x, y = y, color = "Species", shape = "Species")) + | |
geom_point() + | |
scale_color_brewer(palette = "Dark2") + | |
theme(legend.position = "none", plot.title = element_text(size = 7)) + | |
labs(x = NULL, y = NULL, title = paste0(y, " ~ ", x)) |