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
# Using the dataUSA.io API for Census Data in R | |
This gist contains some notes on constructing a query for census and economic data from the [DataUSA.io](http://datausa.io/) site. This is a quick-start guide to their API; for in-depth documentation check out their [API documentation](https://github.com/DataUSA/datausa-api/wiki/Overview). | |
A great way to learn how to structure a query is to visit a specific datausa.io page and click on the "Options" button on top of any graph, then select "API" to see the query syntax that created the graph. | |
 | |
## Example Use |
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
// Additional tools for machine learning and predictive analytics in stata | |
/* | |
Author: Jared Knowles | |
Date: 09/12/2018 | |
Purpose: Survey of some additional code helpful in conducting and explaining | |
or demonstrating predictive analytics to stakeholders. | |
You do not need to run all of this code - this is a survey of commands that | |
tackle different techniques. Pick and choose what might be most useful to you. | |
*/ |
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
############################################################################### | |
## SDP Fall Workshop Predictive Analytics | |
## Advanced / Additional Code Snippets for Working with PA Data and Models | |
## Author: Jared E. Knowles | |
## Date: 09/14/2018 | |
## You do not need to use all or even any of this code. The code does not need to | |
## be run together. This is just a survey of some additional techniques/tricks you | |
## can do in R to make explaining predictive models and complex data easier. | |
## As always - your needs and approaches may different. | |
################################################################################ |
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
################################################################################ | |
# Functions to find the data | |
################################################################################ | |
# Finders | |
# Simple functions that take the ID code from CPE (e.g. 49-00039) and look up | |
# the respective data for it in the structure provided in teh competition | |
find_police_shape <- function(dept_id, kaggle_kernel = FALSE) { | |
if(kaggle_kernel == TRUE) { | |
prefix = "../input/cpe-data/" |
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
################################################################################################### | |
## Title: Regression Module Assignment 1 | |
## Exploring Student Composition Effects on Test Score Growth | |
## Author: Jared E. Knowles, Civilytics Consulting | |
## Date: 6/12/2019 | |
## Last Updated: 6/17/2019 | |
################################################################################################### | |
# ---------------------------------------------------------------------------- | |
# Load the data |
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
# Load ggplot2 | |
library(ggplot2) | |
# Load example data | |
data(mtcars) | |
# Create a character vector of car names | |
mtcars$name <- row.names(mtcars) | |
# Plot car names by mpg | |
ggplot(mtcars, aes(x = name, y = mpg)) + |
OlderNewer