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
# Archivo PDF de: | |
# http://ddhh.minjusticia.gob.cl/informacion-sobre-la-situacion-del-pais-desde-el-19-de-octubre | |
# 2019-12-05: https://www.scribd.com/document/438470416/Datos-05-12-19#download | |
# Librerias ----------------------------------------------------------------------------------- | |
library(tidyverse) | |
library(tabulizer) | |
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
# FROM: https://github.com/JonMinton/COVID-19 | |
DF = tidied_data %>% | |
filter(type == "confirmed") %>% | |
mutate( | |
higher = case_when( | |
higher == "Iran (Islamic Republic of)" ~ "Iran", | |
higher == "Hong Kong SAR" ~ "Hong Kong", |
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
# Libraries --------------------------------------------------------------- | |
library(tidyverse) | |
library(data.table) | |
# Read data --------------------------------------------------------------- | |
# DOWNLOAD DATA FROM: https://momo.isciii.es/public/momo/dashboard/momo_dashboard.html#datos |
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
# Using {rtweet} (https://github.com/ropensci/rtweet) to check how much Trump tweeted in the last few days | |
# Libraries | |
library(rtweet) | |
library(tidyverse) | |
# Get Twitter token | |
file_name <- file.path(".rtweet_token5.rds") | |
twitter_token = readRDS(file = file_name) |
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(tidyverse) | |
library(haven) | |
DF = read_sav("3312.sav") # Datos de http://www.cis.es/cis/opencm/ES/1_encuestas/estudios/ver.jsp?estudio=14551 | |
DIC = lapply(DF, attr, which = "label") %>% as_tibble() %>% pivot_longer(1:ncol(.)) %>% rename(nombre = value) | |
DF_plot = | |
DF %>% | |
sjlabelled::remove_all_labels() %>% | |
as_tibble() %>% |
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(tidyverse) | |
DF = tibble(country = c("a", "a", "b", "b", "b"), | |
value = c(1, 1.01, 2, 2.01, 2), | |
size_dot = c(4, 2, 1, 3, 6)) | |
plot1 = ggplot(DF, aes(value, country, fill = country)) + | |
geom_point(aes(size = size_dot), shape = 21, alpha = .5, position = position_dodge2(width = .2))#position_jitterdodge(seed = 5)) | |
plot2 = ggplot(DF, aes(value, country, fill = country)) + |
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
# Data from: https://gssdataexplorer.norc.org/trends | |
# Inspiration: https://twitter.com/_cingraham/status/1487094406159110147 | |
library(tidyverse) | |
library(readxl) | |
library(geomtextpath) | |
FILES = list.files(path = "~/Downloads/", pattern = "happy", full.names = TRUE) | |
DF_raw = map_df(FILES, read_excel, skip = 11) |
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
detect_file_encoding <- function(file_path) { | |
# MUCH SIMPLER, and should work most of the time | |
# file_path = "..." | |
# ENC = readr::guess_encoding(file_path, n_max = 1000) | |
# readr::read_csv(file_path, skip = 12, locale = locale(encoding = ENC$encoding[1])) | |
library(cli) | |
library(dplyr) |