Skip to content

Instantly share code, notes, and snippets.

View danielredondo's full-sized avatar

Daniel Redondo danielredondo

View GitHub Profile
@danielredondo
danielredondo / notas.R
Last active September 8, 2020 09:56
Script para reproducir el siguiente gráfico: https://twitter.com/dredondosanchez/status/1287779985596579841
library(readxl)
library(dplyr)
library(ggplot2)
library(cowplot)
library(magick)
# Para fuentes
library(extrafont)
# font_import()
loadfonts(device = "win")
# Pequeñas modificaciones de http://larmarange.github.io/JLutils/reference/A2Rplot.html
#' Colored dendrogram
#'
#' This function plot an dendrogram with different colors to each cluster
#' for a given number of classes. See examples.
#'
#' @param x an \code{\link[stats]{hclust}} object to plot
#' @param k the number of clusters
# Referencia: https://twitter.com/thomasp85/status/968483985939673089
# https://gist.github.com/thomasp85/0938c3ece34b9515d889f3b1f9c3fc9c
library(magick)
library(reshape2)
library(dplyr)
library(tidygraph)
library(particles)
library(animation)
library(pageviews)
library(dplyr)
library(ggplot2)
# Leyenda no en formato científico
options(scipen = 10000)
# Lo más leído del mes de Junio
top <- top_articles(project = "es.wikipedia",
start = as.Date("2020-06-01"),