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(epidata) # install.packages("epidata") | |
library(hrbrthemes) # install.packages("hrbrthemes") | |
library(tidyverse) | |
xdf <- get_median_and_mean_wages("l") | |
select(xdf, -median, -average) %>% | |
gather(measure, value, -date) %>% | |
mutate(measure = str_replace_all(measure, "_", " ")) %>% | |
mutate(measure = str_to_title(measure)) %>% |
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
> parse_ns_file("~/packages/iptools/") | |
$imports | |
$imports[[1]] | |
[1] "AsioHeaders" | |
$imports[[2]] | |
[1] "stats" | |
$imports[[3]] | |
[1] "stringi" |
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(Rcpp) | |
library(dplyr) | |
library(ggplot2) # devtools::install_github("tidyverse/ggplot2") | |
#' @param ips a vector of numeric IPv4 addresses | |
#' @param addr_space_bits_per_image (will depend on CIDR being shown - default = full IPv4) | |
#' @param addr_space_bits_per_pixel (normally 1 pixel == 256 addrs; this mods that) | |
cppFunction(' | |
List ips_to_xy(std::vector<unsigned> ips, | |
int addr_space_bits_per_image = 32L, |
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
cc | routed_unused | unrouted_unused | used | unused_combined | pct_used | pct_unused | pct_lab | used_ct | unused_ct | continent | id | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
ad | 24 | 0 | 119 | 24 | 0.8321678321678322 | 0.16783216783216784 | 16.8% | 30464 | 6144 | Europe | AND | |
ae | 2953 | 975 | 8326 | 3928 | 0.6794516076383221 | 0.3205483923616778 | 32.1% | 2131456 | 1005568 | Asia | ARE | |
af | 112 | 165 | 304 | 277 | 0.5232358003442341 | 0.47676419965576594 | 47.7% | 77824 | 70912 | Asia | AFG | |
ag | 60 | 29 | 118 | 89 | 0.5700483091787439 | 0.42995169082125606 | 43.0% | 30208 | 22784 | Americas | ATG | |
ai | 6 | 2 | 36 | 8 | 0.8181818181818182 | 0.18181818181818182 | 18.2% | 9216 | 2048 | Americas | AIA | |
al | 407 | 54 | 511 | 461 | 0.5257201646090535 | 0.4742798353909465 | 47.4% | 130816 | 118016 | Europe | ALB | |
am | 494 | 37 | 1788 | 531 | 0.7710219922380336 | 0.22897800776196636 | 22.9% | 457728 | 135936 | Asia | ARM | |
ao | 2671 | 22 | 650 | 2693 | 0.1944361352078971 | 0.8055638647921028 | 80.6% | 166400 | 689408 | Africa | AGO | |
ap | 0 | 2 | 7 | 2 | 0.7777777777777778 | 0.2222222222222222 | 22.2% | 1792 | 512 | Asia | NA |
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(httr) | |
library(tidyverse) | |
GET( | |
url = "https://projects.propublica.org/electionbot/api/v1/firehose.json", | |
httr::add_headers( | |
Accept = "application/json, text/javascript, */*; q=0.01", | |
`Accept-Language` = "en-US,en;q=0.5", | |
`Cache-Control` = "max-age=0", | |
Connection = "keep-alive", |
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(purrr) | |
script <- ' | |
library(js) ; library(foo) | |
# | |
library("V8") | |
ls() | |
library(package=rvest) | |
TRUE | |
library(package="hrbrthemes") |
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(ggalt) | |
library(cdcfluview) | |
library(hrbrthemes) | |
library(tidyverse) | |
ili <- ilinet("national", years = 2013:2018) | |
update_geom_font_defaults(font_rc) | |
theme_set(theme_ipsum_rc(grid="XY", strip_text_face = "bold")) |
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
Only including this file so the title of the gist isn't `.gitignore` |
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(grid) | |
library(gridExtra) | |
mydf <- data.frame(id = c(1:5), value = c("A","B","C","D","E")) | |
mytheme <- ttheme_default(base_size = 10, | |
core = list(fg_params=list(hjust=0, x=0.01), | |
bg_params=list(fill=c("white", "lightgrey")))) | |
tg <- tableGrob(mydf, cols = NULL, theme = mytheme, rows = NULL) |
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
# This function will walk you through the creation of a remote repository on github | |
# without wasting your precious time going to the website :) | |
# how: | |
# - source it in your (bash|zsh)rc | |
# - change the alias at the bottom of the script to your needs | |
# - call it, follow instructions... profit | |
function createRemoteGitRepository() { | |
local RED='\033[0;31m' | |
local NC='\033[0m' # No Color | |
local GITHUB_USER='' |