Skip to content

Instantly share code, notes, and snippets.

library(tidyverse)
library(tidycensus)
library(leaflet)
library(sf)
library(shiny)
library(ggmap)
library(htmltools)
# Data --------------------------------------------------------------------
@kellobri
kellobri / app.R
Created May 14, 2021 00:33
Bookmarking & Commenting App Template
#
# Bookmarking
# Annotations & Commenting
# Gitlink
#
library(shiny)
library(gitlink)
# Define UI for application that draws a histogram
@segheysens
segheysens / hi_mask_hvnp.geojson
Created February 15, 2021 14:15
Hawai'i masking layer that leaves out Hawai'i Volcanoes National Park
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alistaire47
alistaire47 / 2020-09-22_LA-RUG_Uncomfortable-data.R
Created September 22, 2020 19:00
2020-09-22 LA R Users Group talk: Uncomfortable data
#' Uncomfortable data
#' LA R Users Group
#' 2020-09-22
#' Edward Visel
#' Setup
library(tidyverse)
path <- '/tmp/nycflights13/flights.csv'
@dianaow
dianaow / index.html
Created September 12, 2020 04:37
Using deck.gl with Mapbox GL JS (Method 2): Using deck.gl layers as custom Mapbox layers
<html>
<head>
<title>Using deck.gl with Mapbox GL JS (Method 2)</title>
<script src="https://d3js.org/d3.v5.min.js" type="text/javascript"></script>
<script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script>
<script src="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel="stylesheet" />
<style type="text/css">
body {
@dianaow
dianaow / index.html
Created September 12, 2020 04:27
Using deck.gl with Mapbox GL JS (Method 1): Deck canvas overlay
<html>
<head>
<title>deck.gl ScatterplotLayer Example</title>
<script src="https://d3js.org/d3.v5.min.js" type="text/javascript"></script>
<script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script>
<script src="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel="stylesheet" />
<style type="text/css">
body {
library(geofacet)
library(ggplot2)
# original plot
ggplot(election, aes(candidate, votes / 1000000, fill = candidate)) +
geom_col() +
scale_fill_manual(values = c("#4e79a7", "#e15759", "#59a14f")) +
facet_geo(~ state, grid = "us_state_grid2") +
coord_flip() +
ylab("Votes (millions)")
---
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r message=FALSE, warning=FALSE}
library(tidyverse)
library(geofacet)
library(ggplot2)
# original plot
ggplot(election, aes(candidate, votes / 1000000, fill = candidate)) +
geom_col() +
scale_fill_manual(values = c("#4e79a7", "#e15759", "#59a14f")) +
facet_geo(~ state, grid = "us_state_grid2") +
coord_flip() +
ylab("Votes (millions)")
# Code for quick exploration of
# https://github.com/rfordatascience/tidytuesday/tree/master/data/2020/2020-05-26
# Video at https://youtu.be/kHFmtKCI_F4
library(tidyverse)
cocktails <- readr::read_csv("boston_cocktails.csv")
# Are name and row_id equivalent? -----------------------------------------