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(vcd)
## Warning: package 'vcd' was built under R version 3.1.3
## Loading required package: grid
counts = table(Arthritis$Improved)
barplot(counts, main = "simple bar plot", xlab = "improvement", ylab = "frequency")
barplot(counts, main = "horizontal bar plot", ylab = "improvement", xlab = "frequency", horiz = TRUE)
counts = table(Arthritis$Improved, Arthritis$Treatment)
counts
##
## Placebo Treated
## None 29 13
## Some 7 7
## Marked 7 21
barplot(counts, main = "stack",col = c("red", "yellow","green"))
legend(x = 2, y = 55, c(rownames(counts)),col = c("red", "yellow","green"),pch = c(15,15))
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.