Skip to content

Commit cad58db

Browse files
committed
prepare deprecating pander.return and pander.option
1 parent 87e29b4 commit cad58db

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export(pander)
7474
export(pander.option)
7575
export(pander.return)
7676
export(panderOptions)
77+
export(pander_return)
7778
export(pandoc.date)
7879
export(pandoc.date.return)
7980
export(pandoc.emphasis)

R/S3.R

+20-9
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,26 @@ pander <- function(x = NULL, ...) {
106106
}
107107

108108

109-
#' Pander and capture output
109+
#' Deprecated pander_return
110110
#'
111111
#' This is a wrapper function around \code{pander} but instead of printing to \code{stdout}, this function returns a character vector of the captured lines.
112112
#' @param ... everything passed to \code{pander}
113113
#' @export pander.return
114114
#' @usage pander.return(...)
115115
#' @seealso pander
116-
pander.return <- function(...)
116+
pander.return <- function(...) {
117+
.Deprecated('pander_return')
118+
capture.output(pander(...))
119+
}
120+
121+
122+
#' Pander and capture output
123+
#'
124+
#' This is a wrapper function around \code{pander} but instead of printing to \code{stdout}, this function returns a character vector of the captured lines.
125+
#' @param ... everything passed to \code{pander}
126+
#' @export
127+
#' @seealso pander
128+
pander_return <- function(...)
117129
capture.output(pander(...))
118130

119131

@@ -1543,9 +1555,9 @@ pander.function <- function(x, add.name = FALSE, verbatim = TRUE, syntax.highlig
15431555
#' s[even] <- sprintf("(%s)", s[even])
15441556
#' s
15451557
#' }
1546-
#' tab <- tabular( Justify(c)*Heading()*z*Sex*Heading(Statistic)*Format(fmt())*(mean+sd)
1558+
#' tab <- tabular( Justify(c)*Heading()*z*Sex*Heading(Statistic)*Format(fmt())*(mean+sd)
15471559
#' ~ Status )
1548-
#' pander(tab, emphasize.rownames = FALSE)
1560+
#' pander(tab, emphasize.rownames = FALSE)
15491561
pander.tabular <- function(x, caption = attr(x, 'caption'), emphasize.rownames = TRUE, digits = panderOptions('digits'), ...) {
15501562
if (is.null(caption) & !is.null(storage$caption))
15511563
caption <- get.caption()
@@ -1557,17 +1569,16 @@ pander.tabular <- function(x, caption = attr(x, 'caption'), emphasize.rownames =
15571569
if (!is.null(colnames(rlabels))) { # needed for case of more complex tabular structure (see examples)
15581570
cl <- colnames(rlabels)
15591571
data <- cbind(rlabels, data)
1560-
clabels <- cbind(rbind(matrix("",
1561-
nrow = (nrow(clabels) - 1),
1572+
clabels <- cbind(rbind(matrix("",
1573+
nrow = (nrow(clabels) - 1),
15621574
ncol = length(cl)),
1563-
colnames(rlabels)),
1575+
colnames(rlabels)),
15641576
clabels)
1565-
}
1577+
}
15661578
clabels <- apply(clabels, c(2), paste, collapse = "\\ \n")
15671579
colnames(data) <- clabels
15681580
if (emphasize.rownames)
15691581
pandoc.table(data, caption = caption, keep.line.breaks = TRUE, emphasize.cols = 1:length(cl), ...)
15701582
else
15711583
pandoc.table(data, caption = caption, keep.line.breaks = TRUE, ...)
15721584
}
1573-

R/options.R

+1
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ panderOptions <- function(o, value) {
295295
#' @export pander.option
296296
#' @seealso panderOptions
297297
pander.option <- function(x, ...) {
298+
.Deprecated('panderOptions')
298299
mc <- match.call(panderOptions)
299300
mc[[1]] <- quote(panderOptions)
300301
eval(mc)

man/pander.return.Rd

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
% Please edit documentation in R/S3.R
33
\name{pander.return}
44
\alias{pander.return}
5-
\title{Pander and capture output}
5+
\title{Deprecated pander_return}
66
\usage{
77
pander.return(...)
88
}

man/pander_return.Rd

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
% Generated by roxygen2 (4.1.1): do not edit by hand
2+
% Please edit documentation in R/S3.R
3+
\name{pander_return}
4+
\alias{pander_return}
5+
\title{Pander and capture output}
6+
\usage{
7+
pander_return(...)
8+
}
9+
\arguments{
10+
\item{...}{everything passed to \code{pander}}
11+
}
12+
\description{
13+
This is a wrapper function around \code{pander} but instead of printing to \code{stdout}, this function returns a character vector of the captured lines.
14+
}
15+
\seealso{
16+
pander
17+
}
18+

0 commit comments

Comments
 (0)