| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/S3.R |
| 3 |
\name{pander} |
| 4 |
\alias{pander} |
| 5 |
\title{Generic pander method} |
| 6 |
\usage{ |
| 7 |
pander(x = NULL, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{an R object} |
| 11 |
|
| 12 |
\item{...}{optional parameters passed to special methods and/or raw \code{pandoc.*} functions} |
| 13 |
} |
| 14 |
\value{ |
| 15 |
By default this function outputs (see: \code{cat}) the result. If you would want to catch the result instead, then call the function ending in \code{.return}. |
| 16 |
} |
| 17 |
\description{ |
| 18 |
Prints an R object in Pandoc's markdown. |
| 19 |
} |
| 20 |
\note{ |
| 21 |
This function can be called by \code{pander} and \code{pandoc} too. |
| 22 |
} |
| 23 |
\examples{ |
| 24 |
|
| 25 |
## Vectors |
| 26 |
pander(1:10) |
| 27 |
pander(letters) |
| 28 |
pander(mtcars$am) |
| 29 |
pander(factor(mtcars$am)) |
| 30 |
|
| 31 |
## Lists |
| 32 |
pander(list(1, 2, 3, c(1, 2))) |
| 33 |
pander(list(a = 1, b = 2, c = table(mtcars$am))) |
| 34 |
pander(list(1, 2, 3, list(1, 2))) |
| 35 |
pander(list(a = 1, 2, 3, list(1, 2))) |
| 36 |
pander(list('FOO', letters[1:3], list(1:5), table(mtcars$gear), list('FOOBAR', list('a', 'b')))) |
| 37 |
pander(list(a = 1, b = 2, c = table(mtcars$am), x = list(myname = 1, 2), 56)) |
| 38 |
pander(unclass(chisq.test(table(mtcars$am, mtcars$gear)))) |
| 39 |
|
| 40 |
## Arrays |
| 41 |
pander(mtcars) |
| 42 |
pander(table(mtcars$am)) |
| 43 |
pander(table(mtcars$am, mtcars$gear)) |
| 44 |
|
| 45 |
## Tests |
| 46 |
pander(ks.test(runif(50), runif(50))) |
| 47 |
pander(chisq.test(table(mtcars$am, mtcars$gear))) |
| 48 |
pander(t.test(extra ~ group, data = sleep)) |
| 49 |
|
| 50 |
## Models |
| 51 |
ml <- with(lm(mpg ~ hp + wt), data = mtcars) |
| 52 |
pander(ml) |
| 53 |
pander(anova(ml)) |
| 54 |
pander(aov(ml)) |
| 55 |
## Dobson (1990) Page 93: Randomized Controlled Trial (examples from: ?glm) |
| 56 |
counts <- c(18, 17, 15, 20, 10, 20, 25, 13, 12) |
| 57 |
outcome <- gl(3, 1, 9) |
| 58 |
treatment <- gl(3, 3) |
| 59 |
m <- glm(counts ~ outcome + treatment, family = poisson()) |
| 60 |
pander(m) |
| 61 |
pander(anova(m)) |
| 62 |
pander(aov(m)) |
| 63 |
## overwriting labels |
| 64 |
pander(lm(Sepal.Width ~ Species, data = iris), covariate.labels = c('Versicolor', 'Virginica')) |
| 65 |
|
| 66 |
## Prcomp |
| 67 |
pander(prcomp(USArrests)) |
| 68 |
|
| 69 |
## Others |
| 70 |
pander(density(runif(10))) |
| 71 |
pander(density(mtcars$hp)) |
| 72 |
|
| 73 |
## default method |
| 74 |
x <- chisq.test(table(mtcars$am, mtcars$gear)) |
| 75 |
class(x) <- 'I heave never heard of!' |
| 76 |
pander(x) |
| 77 |
} |
| 78 |
\references{ |
| 79 |
\itemize{ |
| 80 |
\item John MacFarlane (2013): _Pandoc User's Guide_. \url{https://johnmacfarlane.net/pandoc/README.html} |
| 81 |
\item David Hajage (2011): _ascii. Export R objects to several markup languages._ \url{https://cran.r-project.org/package=ascii} |
| 82 |
\item Hlavac, Marek (2013): _stargazer: LaTeX code for well-formatted regression and summary statistics tables._ \url{https://cran.r-project.org/package=stargazer} |
| 83 |
} |
| 84 |
} |