R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library(ggplot2) 

x<-rnorm(100)
y<-rnorm(100)
plot(x,y)

plot(x,y,xlab = "this is the x-axis", ylab = "this is the y-axis", main = "plot of x vs y")

x
##   [1] -1.39985507  0.13240156 -0.81268930  0.63355686  0.61246086 -0.60035240
##   [7]  0.38953574  1.71092141 -1.57564798 -0.52771878 -1.08353878 -0.72310784
##  [13] -0.39265620  0.07812773  1.39141351  0.65790695  1.65598304 -0.60797384
##  [19] -0.14377909 -1.45584731 -1.35004519  1.46616261  0.25697248  0.22742394
##  [25]  0.67973833  2.45287681 -0.16673367  2.01781283 -0.38173612 -0.31634335
##  [31] -1.28257204 -0.79846677 -0.77305173 -2.42063236  0.48289298 -0.16385073
##  [37] -0.60641540 -0.64710605 -1.18512997  1.22147261 -1.65780691  0.83863678
##  [43] -0.92274153 -0.44631988  0.09576922 -1.43586288 -0.97090637  0.04402521
##  [49] -0.02227404 -0.81926170  0.45635842  0.52271494  0.76159504 -0.14477244
##  [55]  1.36005899 -0.15882504  2.40008477  0.08350162 -0.26812426  0.49429545
##  [61]  1.20380732  0.88095388  0.19148753  0.52068927  0.33489806  0.42205765
##  [67] -1.05077414  0.34098795  0.83849360 -1.92058814  0.22029513  0.64646080
##  [73] -1.75816351  2.06841640 -0.80069937  0.19705238  0.85524723  0.95621682
##  [79]  0.72658798 -0.14819258 -0.23895275  0.75009244  0.37960978 -1.22366881
##  [85]  0.55324627  1.11749140 -0.51483169 -0.50752383 -1.14002378 -0.77840068
##  [91]  0.90175028  2.18433978  0.27231986  0.95881655 -0.70378869  0.61588302
##  [97] -1.84035147  0.64414035  0.03931834 -1.08230608
y<-x^2
plot(x,y,xlab = "this is the x-axis", ylab = "this is the y-axis", main = "plot of x vs y")

x<-c(-10:10)
x
##  [1] -10  -9  -8  -7  -6  -5  -4  -3  -2  -1   0   1   2   3   4   5   6   7   8
## [20]   9  10
y<-x^2
plot(x,y,xlab = "this is the x-axis", ylab = "this is the y-axis", main = "plot of x vs y", type="l")

plot(x,y,xlab = "this is the x-axis", ylab = "this is the y-axis", main = "plot of x vs y", type="p")

plot(x,y,xlab = "this is the x-axis", ylab = "this is the y-axis", main = "plot of x vs y", type="b")

ggplot(data=mpg) + geom_point(mapping = aes(x=displ,y=hwy))

ggplot(data=mpg) + geom_point(mapping = aes(x=displ,y=cty))

ggplot(data=mpg) + geom_point(mapping = aes(x=displ,y=cty, color=class))

ggplot(data=mpg) + geom_point(mapping = aes(x = displ,y=hwy,color=manufacturer))  

ggplot(data=mpg) + geom_point(mapping = aes(x=displ, y=cty), color="blue")

ggplot(data=mpg) + geom_point(mapping = aes(x=displ, y=cty), color="green")

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.