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
P1 <- ggplot(data = party.and.ideology.means.over.time | |
) + geom_point(aes(x = year, y = pid7)) | |
P1 <- P1 + ylim(0,6) + labs(title="geom_point, P1") | |
P1 |
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
#Truncate Data: | |
party.and.ideology<- ANES[,c(1, 12, 14)] | |
head(party.and.ideology) | |
#Step 1 : Melt | |
party.and.ideology.year <- melt(party.and.ideology, id=c("year"), na.rm=TRUE) | |
head(party.and.ideology.year) | |
#Step 1 : Cast | |
party.and.ideology.means.over.time <- (cast(party.and.ideology.year, |
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
anes.year.gender <- melt(ANES, id=c("year", "female"), na.rm=TRUE) | |
head(anes.year.gender) | |
dim(anes.year.gender) |
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(ggplot2) | |
library(gridExtra) | |
library(reshape) | |
anes.year <- melt(ANES, id=c("year"), na.rm=TRUE) | |
head(anes.year) |
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
ANES <- read.csv("http://www.oberlin.edu/faculty/cdesante/assets/downloads/ANES.csv") | |
head(ANES) | |
ANES$caseid <- 1:dim(ANES)[1] | |
head(ANES) | |
dim(ANES) |
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(ggplot2) | |
library(foreign) | |
library(reshape) | |
ANES <- read.dta("http://www.oberlin.edu/faculty/cdesante/assets/downloads/ANESdemo.dta") | |
#Add meaningful labels for Religion | |
ANES$religion[ANES$religion==1] <- "Protestant" | |
ANES$religion[ANES$religion==2] <- "Catholic" | |
ANES$religion[ANES$religion==3] <- "Jewish" |
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
is.R() | |
IQ <- round(rnorm(1000, 100, 15)) | |
#IQ | |
plot(IQ) | |
plot(density(IQ), col="red") |
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
shade.norm <- function(MU, SD, Lower, Upper, fill.color) { | |
cord.x <- c(Lower,seq(Lower,Upper,0.01),Upper) | |
cord.y <- c(0,dnorm(seq(Lower,Upper,0.01), | |
mean = MU, sd = SD),0) | |
y.axis.text <-bquote("Density of N " * " " * "(" * | |
mu * " " * "=" * " " * .(MU) * ","* " " * sigma * | |
" " * "=" * " " * .(SD) * ")") |
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
###### Ordered Categorical DV: ##### | |
#This uses "importance of aid to blacks" as a DV and race of R as the indicator IV.# | |
library(MASS) | |
white <- c(1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1, | |
1,1,0,1,1,1,1,1,1,1,1,1,0,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,1,1,1,0,1,1, | |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0, | |
1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,0,0,1,1,1,1,1,1,1,0,1,0,0,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1, | |
0,1,1,0,1,1,1,1,1,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1, | |
1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1, |
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
Step 1: Go to the theme of your Tumblr account, | |
and add the following code snippet above the </head>: | |
<script type="text/javascript" | |
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> | |
</script> | |
Step 2: Use LaTeX as normal: | |
MathJax has two different ways to begin a TeX section, |