Yan — Sep 11, 2013, 8:01 AM
#library(lattice)
#library(ggplot2)
# Rpub
#install.packages('knitr', dependencies = TRUE)
# different way of installing
#update.packages(ask = FALSE, repos = 'http://cran.rstudio.org')
#install.packages('knitr', repos = c('http://rforge.net', 'http://cran.rstudio.org'),
# type = 'source')
################
#library(knitr)
#library(markdown)
#knitr::knit2html
##knit("Foo.Rmd")
##markdownToHTML("Foo.md", "Foo.html")
#####################
# knit(input)
setwd("C:/Users/Yan/Dropbox/Important_File/2013-2014Courses/545_R/exercise/")
a <- 2
b <- 7
sigSq <- 0.5
n <- 400
set.seed(1234)
x <- runif(n)
y <- a + b * x + rnorm(n, sd = sqrt(sigSq))
(avgX <- mean(x))
[1] 0.4969
#write(avgX, "results/avgX.txt")
#pdf("niftyPlot.pdf")
plot(x, y)
abline(a, b, col = "blue", lwd = 2)
sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitr_1.4.1
loaded via a namespace (and not attached):
[1] digest_0.6.3 evaluate_0.4.7 formatR_0.9 stringr_0.6.2
[5] tools_3.0.1
#dev.off()