Click on the map to add points. See the console for lat/long output.
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(tidycensus) | |
# My recommendation is to use the tidycensus library to make getting this data | |
# easier than reading in the data from the Census website. | |
# | |
# Before you can begin, you'll need to get an API key from the Census Bureau. | |
# You can acquire one here: | |
# | |
# Once you have the API key, run the following in RStudio: |
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(charlatan) | |
library(salty) | |
library(magrittr) | |
library(readr) | |
messydata <- ch_generate('name','job','phone_number', n = 200) | |
messydata <- messydata %>% | |
mutate(job = salt_capitalization(job)) %>% | |
mutate(phone_number = salt_na(phone_number)) %>% |
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(readxl) | |
data <- readxl::read_xlsx("data.xlsx") | |
reshaped <- data %>% gather(word, freq, 2:21) | |
reshaped <- reshaped %>% drop_na() | |
cleaned <- reshaped %>% | |
uncount(freq) |
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(maps) | |
library(mapdata) | |
data <- read_csv("~/Desktop/nplsuperfund.csv") | |
names(data) <- c("lat","lon","date") | |
# Filter down to USA extent to remove extraneous points | |
tidy <- data %>% | |
filter(lat < -67, lat > -125) %>% |
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(hexSticker) | |
library(tidyverse) | |
library(tidycensus) | |
library(sf) | |
library(viridis) | |
options(tigris_use_cache = TRUE) | |
nebraska_raw <- get_acs(state = "NE", | |
geography = "tract", |
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
# Unique values in a dataframe column | |
df['column_name'].unique() | |
# Grab dataframe rows where column = value | |
df = df.loc[df.column == 'some_value'] | |
# Grab dataframe rows where column value is present in a list | |
value_list = ['value1', 'value2', 'value3'] | |
df = df.loc[:,df.columns.isin(valuelist)] | |
# or grab rows where a value is not present in a list |
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
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="http://www.webglearth.com/v2/api.js"></script> | |
<script> | |
function map() { | |
var options = { zoom: 1.5, position: [47.19537,8.524404] }; | |
var earth = new WE.map('earth_div', options); |
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 requires the use of GhostScript | |
# On macOS, the easiest way to get started is install with Homebrew | |
# brew install ghostscript | |
# | |
# This file should live in the directory that contains the PDFs. From | |
# the command line, just running `bash batch.sh` will compress the PDFs | |
# and fix any issues that might be present with JPEG2000 images. The | |
# compression process should preserve the OCR and will likely reduce the | |
# size of the PDF as well. | |
# |
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
import tweepy | |
# OAuth is the preferred method for authenticating to Twitter | |
# Consumer keys are under the application's Details page at | |
# http://dev.twitter.com/apps | |
consumer_key = "" | |
consumer_secret = "" | |
# Access tokens are found on your applications' Details page | |
# at http://dev.twitter.com/apps. |