Code highlight themes in knitr: "edit-nedit"
# function args are keywords c; function names are keywords d foo = function(arg1 = 100, arg2 = "character string") { if (TRUE) { x = NULL # if, function, NULL are keywords a for (i in 1:10) x = c(x, mean(3 * rnorm(100) + 1)) } } # <-, = and -> are keywords b x <- TRUE && FALSE %in% c(T, F)
x = sqrt(-1) # warning
## Warning: NaNs produced
message("knitr says hello to HTML!") # message
1 + "a" # error
## Error: non-numeric argument to binary operator
Let's ask R what is the value of π? Of course it is 3.1416
.