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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#' Filter (subset) a Spatial*DataFrame object | |
#' | |
#' @param object a \code{Spatial*DataFrame} | |
#' @param ... see \link{subset} | |
#' @param .dots | |
#' | |
#' @importFrom lazyeval all_dots lazy_eval | |
#' | |
#' @return a subset of the original \code{Spatial*DataFrame} | |
#' |
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
di "`lala'" | |
local lala "`lala' haha" | |
di "`lala'" | |
local lala "`lala' hehe" | |
di "`lala'" |
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
********************************************************************** | |
* 2008 POVERTY GUIDELINES | |
* http://aspe.hhs.gov/2008-hhs-poverty-guidelines | |
********************************************************************** | |
******************** | |
* Add hiu_fpgbase | |
******************** | |
gen hiu_fpgbase = 10400 |
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
replace year = 2 * floor(year / 2) |
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
# devtools::install_github("jjchern/zipzcta") | |
# devtools::install_github("jjchern/zcta") | |
library(dplyr) | |
# ZIP codes to ZCTAs | |
zipzcta::zipzcta | |
# ZCTAs to Counties | |
zctacounty = zcta::zcta_county_rel_10 %>% |
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
### Most of the summary is taken from the awesome R twotorials at http://www.twotorials.com/ by Anthony Damico | |
### Some of it are my additions from my experience. This is intended so you can Ctrl+F and find what you want using | |
### common names of functions and concepts from other languages or statistics. | |
### Troubleshooting: Search http://tolstoy.newcastle.edu.au/R/ , http://www.r-bloggers.com/, http://www.rseek.org/ | |
### Basics | |
traceback() # Get the call stack after an error, for debugging | |
32 %% 2 # == 0 mod operator | |
5 %/% 3 # == 1 integer division |
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
capture program drop matchmcps | |
program matchmcps | |
args year | |
loc year_plus_1 = `year' + 1 | |
// Step 1: Load data for individuals in time t + 1 | |
u mmm.dta if year == `year_plus_1' & mish >= 5, clear | |
la drop statefip_lbl | |
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
## Mainly borrowed from @jennybc | |
## Location: In root directory of an R project | |
RPROJ = list(PROJHOME = normalizePath(getwd())) | |
## Add a cd function, so that I can just cd("input") and then cd("code") | |
RPROJ$cd = function (subdir) { | |
sdir = file.path(PROJHOME, subdir) | |
setwd(sdir) |
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: "Test" | |
output: revealjs::revealjs_presentation | |
--- | |
## Leaflet | |
```{r, echo=FALSE, results='asis', warning=FALSE} | |
library(leaflet) | |
leaflet() %>% | |
addTiles() %>% |
NewerOlder