This file contains 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
X <- 1:5 | |
Y <- c(2, 5, 2.4, 3.67, 0.49) | |
qplot(X, weight=Y, geom="bar", ymin=0, xlab="X axis abel", ylab="Y axis label" | |
, main="MAIN LABEL")+ scale_y_continuous(limits=c(0, 5),breaks=c(1,2,3,4,5),labels=c("Strongly Disagree", | |
"Disagree","Neutral","Agree","Strongly Agree")) + theme_bw() |
This file contains 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) | |
FEM <- c(rep(1, 100), rep(0, 100)) | |
Gender <- c(rep("Female", 100), rep("Male", 100)) | |
pid7 <- sample(0:6, 200, replace=T) | |
Bfem <- rnorm(200, 1.94, 0.37) | |
Bpid <- rnorm(200, -1.45, 0.82) | |
Binter <- rnorm(200, 0.31, .11) | |
B0 <- rnorm(200, 74.2, .29) |
This file contains 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
#by Christopher DeSante# | |
#Load ggplot2 # | |
library(ggplot2) | |
### X-axis: ### | |
anes.years <- c(1988, 1990, 1992, 1994, 2000, 2004, 2008,2016) | |
## Some DVs ## | |
mum1<-rnorm(8, 8,1) | |
mum2<-rnorm(8, 8,1) |
This file contains 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
#Set the working directory, plots will be saved locally. | |
library(ggplot2) | |
X <- rnorm(100) | |
Y <- rnorm(100) | |
Z <- rnorm(100) | |
A <- rnorm(100) | |
B <- rnorm(100) | |
This file contains 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
#The birthday Problem. | |
#Simple computation: | |
N <- 1:50 | |
pshare <- 1- exp(-(N*(N-1)/2)/365) | |
cbind(N, pshare) | |
#just want one value: | |
bday <- function(X){ | |
N <- X |
This file contains 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
Run from the command prompt in Windows: | |
attrib +h *.bak /s | |
attrib +h *.blg /s | |
attrib +h *.aux /s | |
you can hide system files so all you see locally is the .tex and .pdf |
This file contains 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 code produces a faceted plot of dyad-level data with asymmetry in the variable of interest across dyads. | |
MYDATA <- matrix(rnorm(16*16), 16, 16) | |
diag(MYDATA) <- rep(NA, 16) | |
MYDATA | |
colnames(MYDATA) <- rownames(MYDATA) <- LETTERS[1:16] | |
MYDATA | |
sender.row <- c() | |
receiver.col <- c() | |
value.to.plot <-c() |
This file contains 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
#R as a giant awesome calculator: | |
4+5 | |
exp(5) | |
log(10) | |
log(exp(6)) | |
log(10, base=10) | |
sqrt(64) | |
pi^2 | |
sqrt(pi^2) | |
pi |
This file contains 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
#Plotting Random Variables | |
#rnorm(N, mean, sd): generates a | |
#random normal variable of length N | |
#with specified mean and std. dev. (sd) | |
# x/ylim = range of X/Y axis. | |
#col: colors, specified with an ifelse() | |
#pch, plot symbol to use | |
#pch list: http://voteview.com/symbols_pch.htm | |
X <- rnorm(500) #draw var 1 |
This file contains 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, |
OlderNewer