Skip to content

Instantly share code, notes, and snippets.

@tylermorganwall
tylermorganwall / humanity_globe.R
Created August 17, 2021 14:37
3D Humanity Globe
library(rayshader)
library(rayrender)
popdata = raster::raster("gpw_v4_population_density_rev11_2020_15_min.tif")
population_mat = rayshader:::flipud(raster_to_matrix(popdata))
above1 = population_mat > 1
above5 = population_mat > 5
above10 = population_mat > 10
@cavedave
cavedave / age15to64.r
Last active July 10, 2022 13:40
Sex Ratio in Europe based on code from https://jschoeley.github.io/2018/07/03/bubble-grid_vs_choropleth.html Norway has a missing spot in future combine Nord Trøndelag and Sort Trønderlag to fill this out.
library(eurostat) # eurostat data
library(rnaturalearth) # worldwide map data
library(tidyverse) # tidy data transformation
library(lubridate) # date and time support
library(sf) # simple features GIS
library(RColorBrewer)
euro_pop <-
get_eurostat('demo_r_pjanaggr3', stringsAsFactors = FALSE) %>%
@un33k
un33k / sed cheatsheet
Created August 22, 2011 13:28
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'