pander | R Documentation |
Prints an R object in Pandoc's markdown.
pander(x = NULL, ...)
x |
an R object |
... |
optional parameters passed to special methods and/or raw |
By default this function outputs (see: cat
) the result. If you would want to catch the result instead, then call the function ending in .return
.
This function can be called by pander
and pandoc
too.
John MacFarlane (2013): _Pandoc User's Guide_. https://johnmacfarlane.net/pandoc/README.html
David Hajage (2011): _ascii. Export R objects to several markup languages._ https://cran.r-project.org/package=ascii
Hlavac, Marek (2013): _stargazer: LaTeX code for well-formatted regression and summary statistics tables._ https://cran.r-project.org/package=stargazer
## Vectors pander(1:10) pander(letters) pander(mtcars$am) pander(factor(mtcars$am)) ## Lists pander(list(1, 2, 3, c(1, 2))) pander(list(a = 1, b = 2, c = table(mtcars$am))) pander(list(1, 2, 3, list(1, 2))) pander(list(a = 1, 2, 3, list(1, 2))) pander(list('FOO', letters[1:3], list(1:5), table(mtcars$gear), list('FOOBAR', list('a', 'b')))) pander(list(a = 1, b = 2, c = table(mtcars$am), x = list(myname = 1, 2), 56)) pander(unclass(chisq.test(table(mtcars$am, mtcars$gear)))) ## Arrays pander(mtcars) pander(table(mtcars$am)) pander(table(mtcars$am, mtcars$gear)) ## Tests pander(ks.test(runif(50), runif(50))) pander(chisq.test(table(mtcars$am, mtcars$gear))) pander(t.test(extra ~ group, data = sleep)) ## Models ml <- with(lm(mpg ~ hp + wt), data = mtcars) pander(ml) pander(anova(ml)) pander(aov(ml)) ## Dobson (1990) Page 93: Randomized Controlled Trial (examples from: ?glm) counts <- c(18, 17, 15, 20, 10, 20, 25, 13, 12) outcome <- gl(3, 1, 9) treatment <- gl(3, 3) m <- glm(counts ~ outcome + treatment, family = poisson()) pander(m) pander(anova(m)) pander(aov(m)) ## overwriting labels pander(lm(Sepal.Width ~ Species, data = iris), covariate.labels = c('Versicolor', 'Virginica')) ## Prcomp pander(prcomp(USArrests)) ## Others pander(density(runif(10))) pander(density(mtcars$hp)) ## default method x <- chisq.test(table(mtcars$am, mtcars$gear)) class(x) <- 'I heave never heard of!' pander(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.