Optionally upload a CSV of data that will be available as data frame "df":
# Thank you to the demos that come with the R installation! cat("Thank you to the demos that come with the R installation!") require(datasets) require(grDevices); require(graphics) make.table <- function(nr, nc) { savepar <- par(mar=rep(0, 4), pty="s") plot(c(0, nc*2 + 1), c(0, -(nr + 1)), type="n", xlab="", ylab="", axes=FALSE) savepar } get.r <- function(i, nr) { i %% nr + 1 } get.c <- function(i, nr) { i %/% nr + 1 } draw.title.cell <- function(title, i, nr) { r <- get.r(i, nr) c <- get.c(i, nr) text(2*c - .5, -r, title) rect((2*(c - 1) + .5), -(r - .5), (2*c + .5), -(r + .5)) } draw.plotmath.cell <- function(expr, i, nr, string = NULL) { r <- get.r(i, nr) c <- get.c(i, nr) if (is.null(string)) { string <- deparse(expr) string <- substr(string, 12, nchar(string) - 1) } text((2*(c - 1) + 1), -r, string, col="grey50") text((2*c), -r, expr, adj=c(.5,.5)) rect((2*(c - 1) + .5), -(r - .5), (2*c + .5), -(r + .5), border="grey") } nr <- 20 nc <- 2 oldpar <- make.table(nr, nc) i <- 0 draw.title.cell("Arithmetic Operators", i, nr); i <- i + 1 draw.plotmath.cell(expression(x + y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x - y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x * y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x / y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x %+-% y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x %/% y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x %*% y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x %.% y), i, nr); i <- i + 1 draw.plotmath.cell(expression(-x), i, nr); i <- i + 1 draw.plotmath.cell(expression(+x), i, nr); i <- i + 1 draw.title.cell("Sub/Superscripts", i, nr); i <- i + 1 draw.plotmath.cell(expression(x[i]), i, nr); i <- i + 1 draw.plotmath.cell(expression(x^2), i, nr); i <- i + 1 draw.title.cell("Juxtaposition", i, nr); i <- i + 1 draw.plotmath.cell(expression(x * y), i, nr); i <- i + 1 draw.plotmath.cell(expression(paste(x, y, z)), i, nr); i <- i + 1 draw.title.cell("Radicals", i, nr); i <- i + 1 draw.plotmath.cell(expression(sqrt(x)), i, nr); i <- i + 1 draw.plotmath.cell(expression(sqrt(x, y)), i, nr); i <- i + 1 draw.title.cell("Lists", i, nr); i <- i + 1 draw.plotmath.cell(expression(list(x, y, z)), i, nr); i <- i + 1 draw.title.cell("Relations", i, nr); i <- i + 1 draw.plotmath.cell(expression(x == y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x != y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x < y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x <= y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x > y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x >= y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x %~~% y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x %=~% y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x %==% y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x %prop% y), i, nr); i <- i + 1 draw.plotmath.cell(expression(x %~% y), i, nr); i <- i + 1 draw.title.cell("Typeface", i, nr); i <- i + 1 draw.plotmath.cell(expression(plain(x)), i, nr); i <- i + 1 draw.plotmath.cell(expression(italic(x)), i, nr); i <- i + 1 draw.plotmath.cell(expression(bold(x)), i, nr); i <- i + 1 draw.plotmath.cell(expression(bolditalic(x)), i, nr); i <- i + 1 draw.plotmath.cell(expression(underline(x)), i, nr); i <- i + 1
Examples
lists
matrix math
set operations
dates
time series linear regression
bar plot
box plot
pie chart
using uploaded data
plot a simple x-y function
normal distribution and histogram
linear regression
function with loop
functions, tables, math notation
logit regression
f statistic test