Created
August 15, 2014 23:14
-
-
Save anonymous/6b7b201de86ed83f1258 to your computer and use it in GitHub Desktop.
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
data <- read.table("./AnscombeQuartet.csv", header = TRUE, sep =",", dec = ".", colClasses = c("numeric")) | |
mean(data$x1) | |
var(data$x1) | |
sapply(data, mean) | |
sapply(data, var) | |
par(mfrow=c(2,2), mar=c(2.0, 1.5, 1.5, 1.5), oma = c(2,2,2,2), pch = 16) | |
for(i in 1:4){ | |
x = eval(parse(text = paste("data$x",i,sep=""))) | |
y = eval(parse(text = paste("data$y",i,sep=""))) | |
plot( x, y ) | |
abline( lm(y ~ x) ) | |
grid( 10,10 ) | |
} | |
### Plot figures one by one: | |
# par(mfrow=c(2,2), mar=c(2.0, 1.5, 1.5, 1.5), oma = c(2,2,2,2), pch = 16) | |
# plot(data$x1, data$y1, xlab = "x", ylab = "y"); grid(10,10) | |
# abline(lm(data$y1~data$x1)) | |
# | |
# plot(data$x2, data$y2, xlab = "x", ylab = "y"); grid(10,10) | |
# abline(lm(data$y2~data$x2)) | |
# | |
# plot(data$x3, data$y3, xlab = "x", ylab = "y"); grid(10,10) | |
# abline(lm(data$y3~data$x3)) | |
# | |
# plot(data$x4, data$y4, xlab = "x", ylab = "y"); grid(10,10) | |
# abline(lm(data$y4~data$x4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment