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(tikzDevice) | |
library(ggplot2) | |
y <- exp(seq(1,10,.1)) | |
x <- 1:length(y) | |
data <- data.frame(x = x, y = y) | |
tikz(file = "test.tex") | |
plot <- ggplot(data, aes(x = x, y = y)) + geom_line() |
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
#read the ggplot2 library | |
library(ggplot2) | |
#read the data | |
mepDat <- read.csv("ep6.csv") | |
#plot the density for the questions variable | |
plot <- ggplot(mepDat, aes(x = Questions)) | |
plot <- plot + geom_density() | |
plot <- plot + geom_segment(aes(x = median(mepDat$Questions), xend = median(mepDat$Questions), y = 0, yend = .031), linetype = 2) |
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(MASS) | |
library(ggplot2) | |
#generate the fake data | |
covvar <- matrix(c(1,.6,.6,.6,1,.6,.6,.6,1),nr = 3) | |
means <- c(20,25,30) | |
data <- as.data.frame(mvrnorm(100,means,covvar)) | |
#dichotomize the dependent variable | |
data$V1 <- ifelse(data$V1 > 20,1,0) |
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
#generate data | |
library(MASS) | |
covvar <- matrix(c(1,.6,.6,.6,1,.6,.6,.6,1),nr = 3) | |
means <- c(20,25,30) | |
data <- as.data.frame(mvrnorm(100,means,covvar)) | |
#dichotomize the dependent variable | |
data$V1 <- ifelse(data$V1 > 20,1,0) |
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 <- c(1,2,3) | |
plot(x) |
NewerOlder