Skip to content

Instantly share code, notes, and snippets.

View jbkunst's full-sized avatar
🐢
Work it harder Make it better Do it faster

Joshua Kunst jbkunst

🐢
Work it harder Make it better Do it faster
View GitHub Profile
@ivabrunec
ivabrunec / andes.R
Created December 12, 2021 21:22
R code snippet: extract elevation matrix, clip it to a spatial polygon, render with rayshader
library(sf)
library(elevatr)
library(raster)
library(rayshader)
library(dplyr)
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
# read in andes shapefile from https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5466557/
# idk exactly what i'm doing yet
# get extent we're interested in
---
title: "Untitled"
output: html_document
---
```{r include = FALSE}
library(tidyverse)
library(tidyquant)
library(timetk)
library(readxl)
@djnavarro
djnavarro / .Rprofile
Created June 24, 2021 11:30
my .Rprofile settings
if(interactive()) {
cat("\014") # clear screen
cli::cli_text("")
cli::cli_text(R.version$version.string)
cli::cli_text("")
cli::cli_alert_success(
paste0(
@ledell
ledell / kaggledays-sf_h2o_automl_6000.R
Last active March 3, 2022 03:02
KaggleDays SF: H2O AutoML solution
### Kaggle Days SF: Hackathon submission (8th place)
# I used the latest version of H2O (3.24.0.1)
# Latest stable always here: http://h2o-release.s3.amazonaws.com/h2o/latest_stable.html
# H2O 3.24.0.1: http://h2o-release.s3.amazonaws.com/h2o/rel-yates/1/index.html
# If you are a Python user, you can use the demo Python code available on the H2O AutoML User Guide
# instead: http://docs.h2o.ai/h2o/latest-stable/h2o-docs/automl.html
# Unfortunately it was a private competition, so the data is not publicly available!
@timwaterhouse
timwaterhouse / animated_cv.R
Last active January 29, 2020 08:58
gganimate CV
library(ggplot2)
library(tidyr)
library(dplyr)
library(maps)
library(gganimate)
WorldData <- map_data('world')
#WorldData %>% filter(region != "Antarctica") -> WorldData
WorldData <- fortify(WorldData)
# Load the packages we’re going to be using:
# Alongside the usual stuff like tidyverse and magrittr, we’ll be using rvest for some web-scraping, jsonline to parse some JSON, and extrafont to load some nice custom fonts
needs(tidyverse, magrittr, rvest, jsonlite, extrafont)
# Before we go on, two things to note:
# First, on web scraping:
# You should always check the terms of the site you are extracting data from, to make sure scraping (often referred to as `crawling`) is not prohibited. One way to do this is to visit the website’s `robots.txt` page, and ensure that a) there is nothing explicitly stating that crawlers are not permitted, and b) ideally, the site simply states that all user agents are permitted (indicated by a line saying `User-Agect: *`). Both of those are the case for our use-case today (see https://www.ultimatetennisstatistics.com/robots.txt).
# And second, about those custom fonts:
@djnavarro
djnavarro / thank_you_stars.R
Created January 30, 2019 11:17
animated thank you message made from stars
# devtools::install_github("yixuan/fontr")
library(fontr)
library(transformr)
library(showtext)
library(tidyverse)
library(gganimate)
# use showtext to loading Google fonts (http://www.google.com/fonts)
font_add_google("Allura")
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
css:
- default
library(tidycensus)
library(mapdeck)
library(tidyverse)
token <- "your mapbox token"
hv <- get_acs(geography = "tract",
variables = "B25077_001",
state = "CA",
geometry = TRUE) %>%
@jeffeaton
jeffeaton / report.R
Last active January 23, 2020 03:28
Simple YAML header for reports with `knitr::spin()`
#' ---
#' title: "<title>"
#' author: Jeff Eaton
#' output: pdf_document
#' ---
#'
##+ setup, include=FALSE
library(knitr)
opts_chunk$set(tidy=TRUE, warning=FALSE, cache=TRUE, message=FALSE)