italics
bold
r_function_call(with = "arguments")
function
: function in this package.
abbey
: function in another package.
name: link to function, but show name.
name
: link to function in another package, but show name.
Keep Your Head Up!: a url with custom link text.
francois.collin@gmail.com (note the doubled @): an email address.
dummy2
An object of class NULL
of length 0.
The following function turns an R data frame into the correct format. It ignores column and row names, but should get you started. tabular <- function(df, ...) { stopifnot(is.data.frame(df)) align <- function(x) if (is.numeric(x)) "r" else "l" col_align <- vapply(df, align, character(1)) cols <- lapply(df, format, ...) contents <- do.call("paste", c(cols, list(sep = " \tab ", collapse = "\cr\n "))) paste("\tabular{", paste(col_align, collapse = ""), "}{\n ", contents, "\n}\n", sep = "") } cat(tabular(mtcars[1:5, 1:5]))
21.0 | 6 | 160 | 110 | 3.90 |
21.0 | 6 | 160 | 110 | 3.90 |
22.8 | 4 | 108 | 93 | 3.85 |
21.4 | 6 | 258 | 110 | 3.08 |
18.7 | 8 | 360 | 175 | 3.15 |