want to include variables from an R session in mathematical expressions, and substitute in their actual values
substitute()
hist(rnorm(100, x_mean, x_sd),
main = substitute(
paste(X[i], " ~ N(", mu, "=", m, ", ", sigma^2, "=", s2, ")"),
list(m = x_mean, s2 = x_sd^2)
)
)if we want to include variables from an R session in mathematical expressions, and substitute in their actual values, we can use substitute().
a demo that shows you everything about plotting math in R (it was written by the R Core Team
demo(plotmath)
Want to write mathematical symbols and expressions in R graphics?
expression()
library(RColorBrewer)
par(mar = c(0, 4, 0, 0))
display.brewer.all()
the color palettes in RColorBrewer
brewer.pal(8, “Set2”)
generate 8 colors from the Set2 palette