Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 1.2 KB

R_demo_without_ravel.org

File metadata and controls

47 lines (30 loc) · 1.2 KB

Example of R with plain org-babel

Example R code

Minimal example

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

When using just org-babel without ox-ravel and knitr, only the final output of the code chunk is displayed. You don’t get to see the results of intermediate evaluations within the code block.

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")