Skip to content

Instantly share code, notes, and snippets.

View patternproject's full-sized avatar

patternproject

View GitHub Profile
@stephenleo
stephenleo / 00_SQL in Google Colab.md
Last active January 29, 2024 07:31
[Medium] SQL in Google Colab

SQL in Google Colab

All the code for the Medium Post

Open In Colab

@benmarwick
benmarwick / sparkbars_in_Rmd.R
Last active June 13, 2017 09:13
sparkbars in R Markdown
---
output: html_document
---
```{r, fig.show='hide', include=FALSE}
library(colformat)
x1 <- c("Using R Markdown and the colformats package we can put a sparkbar in
line with the text using inline R code, like this `` `r '\x60r spark_bar(x)\x60'` ``.
Here's a sparkbar showing a histogram of the number of characters
in each word in this text: `r spark_bar(x2)`. And here is a sparkbar
airline voluntary_denied involuntary_denied enplaned_ct involuntary_db_per_10k year
Hawaiian Airlines 326 49 10824495 0.05 2016
Delta Air Lines 129825 1238 129281098 0.1 2016
Virgin America 2375 94 7945329 0.12 2016
Alaska Airlines 6806 931 23390900 0.4 2016
United Airlines 62895 3765 86836527 0.43 2016
Spirit Airlines 10444 1117 19418650 0.58 2016
Frontier Airlines 2096 851 14666332 0.58 2016
American Airlines 54259 8312 130894653 0.64 2016
Jetblue Airways 1705 3176 34710003 0.92 2016
@g0t4
g0t4 / Notes.md
Last active July 11, 2022 14:53
Getting Started with Docker on Windows
@cavedave
cavedave / WorldHeat.r
Last active May 19, 2020 19:00
Heatmap of world Temperature in r package for ggplot2
#This is inspired by this piral animation of the same dataset
#http://www.climate-lab-book.ac.uk/2016/spiralling-global-temperatures/
#and this R code to produce the animation
#https://gist.github.com/jebyrnes/b34930da0052a86f5ffe254ce9900357
# It also uses elements of this http://www.r-bloggers.com/making-faceted-heatmaps-with-ggplot2/
# and this https://rpubs.com/bradleyboehmke/weather_graphic graphic
library(dplyr)
library(tidyr)
library(ggplot2)
library(idbr)
library(dplyr)
library(ggplot2)
library(tidyr)
library(countrycode)
library(gganimate)
library(tweenr)
ctrys <- countrycode(c('South Africa', 'Botswana', 'Lesotho', 'Namibia', 'Zimbabwe', 'Swaziland'),
'country.name', 'fips104')
library(rvest)
library(urltools)
library(rmarkdown)
# Some Rmd template setup -----------------------------------------------------------
preamble <- '---
title: "CRAN Mirrors Certificate Expiration Dashboard (Days left from %s)"
output:
flexdashboard::flex_dashboard:
@timelyportfolio
timelyportfolio / Readme.md
Last active February 19, 2023 23:01
3d yield curve with Plotly in R

Nowhere near as spectacular as the Upshot/New York Times 3d yield curve by Amanda Cox and Gregor Aisch, but not bad at all for a couple of lines of R code with the plotly htmlwidget.

library(plotly)
library(dplyr)
library(tidyr)
library(purrr)
library(quantmod)
library(magrittr)

You'll need to make 2 plots and use grid.arrange if you want more uniform spacing in 8.1 and 8.2. You can add a fill to strip.background to extend the background colors and rotate the text with strip.text

@jennybc
jennybc / polygraphing-films.R
Created April 9, 2016 16:46
Get polygraphing's film data into R
## http://polygraph.cool/films/
## https://github.com/matthewfdaniels/scripts
x <- "https://raw.githubusercontent.com/matthewfdaniels/scripts/master/data/character_list5.csv"
characters <- read.csv(x, na.strings = c("NULL", "?"),
fileEncoding = "ISO-8859-1", stringsAsFactors = FALSE)
## some ages are clearly (negative) birth years ... oops
characters$age[!is.na(characters$age) & characters$age < 0] <- NA
characters$age[!is.na(characters$age) & characters$age > 105] <- NA