Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 1.18 KB

R_knitr_demo.org

File metadata and controls

43 lines (27 loc) · 1.18 KB

Example of R with knitr and ox-ravel

Example R code

Minimal example

Show some minimal example code from https://yihui.name/knitr/demo/minimal/

set.seed(1213)
x = cumsum(rnorm(100))
mean(x)
plot(x, type = 'l')

ggplot2 examples

Show some example plots from https://www.mailman.columbia.edu/sites/default/files/media/fdawg_ggplot2.html

library(ggplot2)

scatter <- ggplot(data=iris, aes(x = Sepal.Length, y = Sepal.Width)) 
scatter + geom_point(aes(color=Species, shape=Species)) +
  xlab("Sepal Length") +  ylab("Sepal Width") +
  ggtitle("Sepal Length-Width")

boxplot(Sepal.Length~Species,data=iris, 
        xlab="Species", ylab="Sepal Length", main="Iris Boxplot")