float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
return mix(rand(fl), rand(fl + 1.0), fc);
}
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
| # Deterministically generated normal variates, implemented here in R but more | |
| # useful for GLSL programming. | |
| library(ggplot2) | |
| fract <- function(x) x - floor(x) | |
| rand <- function(x) fract(3482954.234 * sin(24934.342 * x + 12394.32)) | |
| norm <- function(x) { |
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
| --- | |
| title: "COVID-19 Case Fatality Rate (CFR) by age" | |
| output: html_document | |
| --- | |
| ```{r setup, include=FALSE} | |
| knitr::opts_chunk$set(echo = TRUE) | |
| library(tidyverse) | |
| ``` |
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
| # Code for presentation at rstudio::conf2019 | |
| # Slides: | |
| # https://docs.google.com/presentation/d/1zMuBSADaxdFnosOPWJNA10DaxGEheW6gDxqEPYAuado/edit?usp=sharing | |
| # Setup ------------------------------------------------------------------- | |
| library(ggplot2) | |
| library(gganimate) | |
| library(ungeviz) | |
| library(mgcv) |
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
| // This file implements the 2D isoline and isoband algorithms described | |
| // here: https://en.wikipedia.org/wiki/Marching_squares | |
| // Written by Claus O. Wilke | |
| #include <Rcpp.h> | |
| using namespace Rcpp; | |
| #include <iostream> | |
| #include <vector> | |
| #include <utility> // for pair |
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(sf) | |
| # Development version of colorspace is needed. Install via: | |
| # install.packages("colorspace", repos = "http://R-Forge.R-project.org") | |
| library(colorspace) | |
| crs_goode <- "+proj=igh" | |
| world_goode <- st_as_sf(rworldmap::getMap(resolution = "low")) %>% |
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
| --- | |
| title: "World maps" | |
| output: | |
| html_document: | |
| df_print: paged | |
| --- | |
| ```{r echo = FALSE, message = FALSE} | |
| library(tidyverse) | |
| library(sf) |
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(sf) | |
| library(dplyr) | |
| library(ggplot2) | |
| library(gganimate) # needs development version from github | |
| # helper function to place a geometric object at a desired position | |
| # and scale | |
| place_geometry <- function(geometry, position, scale = 1) { | |
| (geometry - st_centroid(geometry)) * scale + | |
| st_sfc(st_point(position)) |
We can't make this file beautiful and searchable because it's too large.
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
| sasdate,RPI,W875RX1,DPCERA3M086SBEA,CMRMTSPLx,RETAILx,INDPRO,IPFPNSS,IPFINAL,IPCONGD,IPDCONGD,IPNCONGD,IPBUSEQ,IPMAT,IPDMAT,IPNMAT,IPMANSICS,IPB51222S,IPFUELS,CUMFNS,HWI,HWIURATIO,CLF16OV,CE16OV,UNRATE,UEMPMEAN,UEMPLT5,UEMP5TO14,UEMP15OV,UEMP15T26,UEMP27OV,CLAIMSx,PAYEMS,USGOOD,CES1021000001,USCONS,MANEMP,DMANEMP,NDMANEMP,SRVPRD,USTPU,USWTRADE,USTRADE,USFIRE,USGOVT,CES0600000007,AWOTMAN,AWHMAN,HOUST,HOUSTNE,HOUSTMW,HOUSTS,HOUSTW,PERMIT,PERMITNE,PERMITMW,PERMITS,PERMITW,AMDMNOx,AMDMUOx,BUSINVx,ISRATIOx,M1SL,M2SL,M2REAL,AMBSL,TOTRESNS,NONBORRES,BUSLOANS,REALLN,NONREVSL,CONSPI,S&P 500,S&P: indust,S&P div yield,S&P PE ratio,FEDFUNDS,CP3Mx,TB3MS,TB6MS,GS1,GS5,GS10,AAA,BAA,COMPAPFFx,TB3SMFFM,TB6SMFFM,T1YFFM,T5YFFM,T10YFFM,AAAFFM,BAAFFM,EXSZUSx,EXJPUSx,EXUSUKx,EXCAUSx,WPSFD49207,WPSFD49502,WPSID61,WPSID62,OILPRICEx,PPICMM,CPIAUCSL,CPIAPPSL,CPITRNSL,CPIMEDSL,CUSR0000SAC,CUSR0000SAD,CUSR0000SAS,CPIULFSL,CUSR0000SA0L2,CUSR0000SA0L5,PCEPI,DDURRG3M086SBEA,DNDGRG3M086SBEA,DSERRG3M086SBEA,CES0600000008,CES2000000008,CES300 |
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(ggplot2) | |
| library(multiscales) | |
| colors <- scales::colour_ramp( | |
| colors = c(red = "#AC202F", purple = "#740280", blue = "#2265A3") | |
| )((0:7)/7) | |
| types <- c( | |
| 'Natural state geometry', | |
| 'Cartogram weigted by electoral votes' |
NewerOlder