Skip to content

Instantly share code, notes, and snippets.

View ryanpeek's full-sized avatar

Ryan Peek ryanpeek

View GitHub Profile
@ryanpeek
ryanpeek / gist-reveal.it-slides.html
Created August 1, 2023 06:59 — forked from ryanj/gist-reveal.it-slides.html
Gist-powered Revealjs slideshow presentations http://gist-reveal.it
<section data-background-transition='zoom' data-transition='concave' data-background='http://ryanjarvinen.com/presentations/shared/img/broadcast_reveal_dark.png' data-state='blackout'>
<h2>Gist-Powered</h2>
<h1>Reveal.js</h1>
<h2>Slideshow Presentations</h2>
<br/>
<h1 class='fragment grow'><a style='color:deepskyblue;' href='http://gist-reveal.it'>gist-reveal.it</a></h1>
</section>
<section data-background-transition='zoom' data-transition='linear' id='try-it'>
<h2>Try it out!</h2>
<p>Create your own deck by forking a copy of <a href='https://gist.github.com/ryanj/af84d40e58c5c2a908dd'>this github gist</a>: <br /><a href='https://gist.github.com/ryanj/af84d40e58c5c2a908dd'>https://gist.github.com/ryanj/af84d40e58c5c2a908dd</a></p>
@ryanpeek
ryanpeek / read zipped shapefile
Last active February 26, 2022 22:48
Read/import a zipped shapefile directly from source
# need these libraries
library(sf)
library(utils)
durl <- "https://water.usgs.gov/GIS/dsdl/gagesII_9322_point_shapefile.zip"
webpath <- durl
get_shp_zip <- function(webpath){
dest_dir <- tempdir() # make temp dir
@ryanpeek
ryanpeek / making_usa_states_composite_maps
Created January 28, 2022 17:12
making USA state composite map w tigris
# us states maps for equal area or otherwise
# best projections for Eq Area is probably Albers Eq Area (CRS 102003)
# for just display, can use a conformal albers or mercator (4326)
# libraries
library(tidyverse)
library(sf)
library(tigris)
options(tigris_use_cache = TRUE)
library(tidycensus)
@ryanpeek
ryanpeek / map_dragons_by_country
Created April 8, 2021 17:21
dragons_by_country
# use polite if scraping multiple pages
# library(polite) # https://dmi3kno.github.io/polite/
library(rvest)
library(tidyverse)
# read wikipedia list of dragons
dragons <- read_html("https://en.wikipedia.org/wiki/List_of_dragons_in_mythology_and_folklore")
# pull out the data from each table
dragons_table <- dragons %>%
@ryanpeek
ryanpeek / rotate_sf_countries
Last active July 25, 2024 16:00
Rotate sf geometries and plot
# libraries
library(ggplot2)
library(dplyr)
library(ggthemes)
#theme_set(theme_map())
library(sf)
library(rnaturalearth)
library(rnaturalearthdata)
# get outlines
@ryanpeek
ryanpeek / making_maps_for_aRt_night.R
Last active February 26, 2020 18:34
some code bits for making yosemite valley 3d topo map
library(mapview)
library(mapedit)
library(sf)
library(tidyverse)
# Make Some Points or Draw a Polygon --------------------------------------
# here we make points manually
yose <- tibble("site"=c("yose_valley_head", "clouds_rest"),
"lon"= c(-119.71047, -119.46836),
@ryanpeek
ryanpeek / dplyr_drop_vs_complete.R
Created January 16, 2020 21:09
example of tidyverse::complete() vs. tidyverse::group_by( .drop=FALSE) functionality
# tidyverse complete vs. .drop=TRUE
library(tidyverse)
# get data
surveys <- read_csv("https://tinyurl.com/y36xgftg")
# how many species in data? (n=40)
surveys %>%
distinct(species) %>%
tally()
@ryanpeek
ryanpeek / get_cdec_data_w_purrr.R
Created November 30, 2018 07:45
get CDEC data with purrr
# Get CDEC data
# 2018-11-29
# R. Peek
library(tidyverse)
library(purrr)
# FUNCTION ----------------------------------------------------------------
get_cdec <- function(
@ryanpeek
ryanpeek / DO_camping_recipes
Created September 2, 2017 06:42
DO_Camping_Recipes
These are a smattering of relatively well-tested Dutch Oven (**DO**) recipes I've used during camping trips over the last few years (to great success)!. I just wanted to start putting them in one place. All of these pretty much use a 12" DO and depending on the dish, between 15-30 briquettes. I may abbreviate things, so C=cup, TBSP=tablespoon, TSP=teaspoon.
# Brownies (1 box serves ~8)
You'll need a spoon and a healthy appetite for chocolate.
## Ingredients
- 1 box dry brownie mix
- Depending on the mix, 2-3 eggs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.