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
unit_effect = rnorm(5) | |
time_effect = rnorm(5) | |
unit = rep(1:5, each = 20) | |
time = rep(1:5, times = 20) | |
x = rnorm(100) | |
y = unit_effect[unit] + time_effect[time] + .5 * x + rnorm(100) | |
df = data.frame(y = y, unit = factor(unit), time = factor(time), x = x) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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: "Latex engine test" | |
author: "William May" | |
date: "December 1, 2019" | |
output: pdf_document | |
--- | |
```{r setup, include=FALSE} | |
library(knitr) | |
opts_chunk$set(echo = TRUE) |
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(rvest) | |
ssp_url = 'http://www.ssp.sp.gov.br/estatistica/pesquisa.aspx' | |
## get the region/municipality form | |
sess = html_session(ssp_url) | |
form = html_form(sess)[[2]] | |
## see form options | |
head(form$fields$`ctl00$conteudo$ddlRegioes`$options) | |
head(form$fields$`ctl00$conteudo$ddlMunicipios`$options) | |
## submit the form to get a new page |

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
## are Trump (or Clinton) rallies associated with hate crimes? | |
library(MASS) | |
## organize data (downloaded from the analysis page, under the "Hate | |
## Incidents" tab) | |
## https://public.tableau.com/profile/matthew.lilley#!/vizhome/TrumpRallies_15676277431850/Population-TrumpRally | |
hate = read.csv('Hate_Incidents_data.csv', check.names = F, | |
stringsAsFactors = F) | |
hate$Geoid = as.factor(hate$Geoid) |
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
## looking at sex trends | |
library(foreign) | |
## oh wow this is a large file | |
gss = read.spss('/home/will/research/gss/GSS7218_R1.sav', to.data.frame = T) | |
## do a bit of organizing | |
names(gss) = tolower(names(gss)) | |
gss$wtssall = as.numeric(as.character(gss$wtssall)) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.