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(scales) | |
| library(stringr) | |
| library(grid) | |
| library(gridExtra) | |
| library(wikipediatrend) | |
| df <- wp_trend(c("R_(programming_language)", "Python_(programming_language)"), | |
| from = "2007-12-01", to = "2017-01-12") |
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) | |
| inv <- function(m) { | |
| n <- nrow(m) | |
| stopifnot(n == ncol(m)) | |
| cofactor <- function(m, i, j) (-1)^(i+j) * det(m[-i, -j, drop = FALSE]) | |
| adjoint <- function(m) { | |
| cofactor_matrix <- outer(seq_len(n), seq_len(n), | |
| Vectorize(function(i, j) cofactor(m, i, j))) |
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(dplyr) | |
| library(ggplot2) | |
| library(ggmap) | |
| library(ropenaq) | |
| library(gridExtra) | |
| # Get pollution data | |
| df <- | |
| aq_measurements( | |
| country = "US", |
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
| ## Purpose: illustrate use of magick, gganimate, and purrr | |
| ## Inspiration: | |
| ## https://rud.is/b/2016/07/27/u-s-drought-animations-with-the-witchs-brew-purrr-broom-magick/ | |
| ## and subsequent discussion on magick vs gganimate: | |
| ## https://twitter.com/hrbrmstr/status/758304420224466944 | |
| library(purrr) | |
| library(ggplot2) | |
| library(gganimate) | |
| library(animation) | |
| library(magick) |
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(tidyr) | |
| library(plyr) | |
| library(dplyr) | |
| library(stringr) | |
| library(ggplot2) | |
| library(scales) | |
| library(ggthemes) | |
| data <- | |
| " |
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
| # Replicating https://t.co/Jq1QfFGpjA | |
| library(rvest) | |
| library(stringr) | |
| library(dplyr) | |
| library(tidyr) | |
| library(purrr) | |
| library(lubridate) | |
| get_and_clean_table <- function(url) { |
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
| # Remake of http://blogs.worldbank.org/opendata/measuring-surgical-systems-new-paradigm-health-systems-strengthening | |
| library(dplyr) | |
| library(purrr) | |
| library(ggplot2) | |
| library(scales) | |
| library(ggthemes) | |
| library(readxl) | |
| library(tidyr) | |
| library(wbstats) |
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
| # A remake of https://twitter.com/DataIsBeautiful/status/742593686509346816 | |
| # using log scales | |
| library(dplyr) | |
| library(purrr) | |
| library(readr) | |
| library(stringr) | |
| library(ggplot2) | |
| library(scales) | |
| library(ggrepel) |
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(purrr) | |
| library(dplyr) | |
| library(rvest) | |
| library(stringr) | |
| library(geoparser) | |
| w_msg <- function(f) { | |
| force(f) | |
| function(...) { | |
| args <- list(...) |
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
| read_sheet <- function(file, sheet) { | |
| readxl::read_excel(file, sheet, skip = 6) %>% clean_data() | |
| } | |
| fix_names <- function(df) { | |
| names(df)[1] <- "location" | |
| names(df)[-1] <- paste(rep(c(2000, 2014), each = length(names(df)[-1]) / 2), | |
| names(df)[-1], sep = "_") | |
| df | |
| } |