Using the CSV listed in https://twitter.com/hadleywickham/status/1351298997483425792?s=20
ICS file created on 2021-01-18 (PET)
Using the CSV listed in https://twitter.com/hadleywickham/status/1351298997483425792?s=20
ICS file created on 2021-01-18 (PET)
# based on https://gist.github.com/andrewheiss/5cb3ec07be2b1bf5dea8806dfaa755e4 | |
# With minor tweaks and translation to Spanish | |
library(tidyverse) | |
library(showtext) | |
font_add_google("Fira Sans Condensed", "firasanscond") | |
font_add_google("Fira Sans Extra Condensed", "firasansextracond") | |
showtext_auto() |
library(tidyverse) | |
library(survminer) | |
library(survival) | |
library(cowplot) | |
library(gridExtra) | |
fit <- survfit(Surv(futime, fustat) ~ rx, data = ovarian) | |
p1 <- ggsurvplot( | |
fit, |
#ref: https://github.com/juliasilge/tidytext/issues/17 | |
library(dplyr) | |
library(hunspell) | |
library(SnowballC) | |
w <- tibble( | |
palabras = c( | |
"celebra", | |
"celebré", |
#Participación Ciudadana Elecciones Congresales Extraordinarias 2020 | |
#Ubigeo: TODOS | |
#ACTUALIZADO EL 27/01/2020 A LAS 12:08 h | |
#,PARTICIPACIÓN,,AUSENTISMO, | |
"DEPARTAMENTO/CONTINENTE","TOTAL ASISTENTES","% TOTAL ASISTENTES","TOTAL AUSENTES","% TOTAL AUSENTES","ELECTORES HÁBILES" | |
"AFRICA","0","0.00","0","0.00","0" | |
"AMAZONAS","157,470","63.68","89,827","36.32","247,297" | |
"AMERICA","0","0.00","0","0.00","0" | |
"ANCASH","570,090","73.25","208,165","26.75","778,255" | |
"APURIMAC","200,529","69.24","89,105","30.76","289,634" |
library(tidyverse) | |
library(rvest) | |
url <- "http://www.sunat.gob.pe/indicestasas/uit.html" | |
uit_table <- html(url) %>% | |
html_node(xpath = "/html/body/div[2]/div/div[1]/div[4]/div[1]/div[1]/center/table") %>% | |
html_table(header = TRUE) %>% | |
janitor::clean_names() | |
uit_df <- uit_table %>% |
library(countrycode) | |
library(tidyverse) | |
library(ggrepel) | |
df <- readxl::read_excel("Sustainable_food_systems_global_index-1.xlsx", sheet = 1, skip = 5) | |
df <- df %>% | |
mutate( | |
region = countrycode(origin = "iso3c", | |
sourcevar = ISO3, |
# Ref: https://twitter.com/Amit_Levinson/status/1187754568014336002 | |
set.seed(2019) | |
gen_grades <- function(n, avg, sd, min, max, nsmpl) { | |
smpl <- rnorm(nsmpl, avg, sd) | |
smpl <- smpl[smpl >= min & smpl <= max] | |
if (length(smpl) >= n) { | |
return(sample(smpl, n)) | |
} else { | |
stop(simpleError("Not enough sample data. Increase 'nsmpl'")) |
# based on the example at: https://echarts4r.john-coene.com/articles/chart_types.html#treemap | |
# the JS example at: https://echarts.apache.org/examples/en/editor.html?c=treemap-show-parent | |
# and the documentation at: https://echarts.apache.org/en/option.html#series-treemap.type | |
library(tidyverse) | |
library(echarts4r) | |
# this data structure does not work with the changed function | |
# set.seed(13579) | |
# |