Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions R/S3.R
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,13 @@ pander.htest <- function(x, caption = attr(x, 'caption'), ...) {
if (!is.null(x$alternative)) {
res['Alternative hypothesis'] <- x$alternative
}
if (!is.null(x$estimate)) {
if (!is.null(names(x$estimate))) {
res[names(x$estimate)] <- x$estimate
} else {
res['Estimate'] <- x$estimate
}
}

## drop placeholder
res$placeholder <- NULL
Expand Down
15 changes: 14 additions & 1 deletion R/pandoc.R
Original file line number Diff line number Diff line change
Expand Up @@ -966,14 +966,27 @@ pandoc.table.return <- function(t, caption, digits = panderOptions('digits'), de
}
if (!keep.trailing.zeros) {
## for-loop is needed to preserve row/col names and use index to get appropriate value from digits vector
## why are we doing this to all columns if we only come here if (length(t.n) > 0)? If we only need to operate
## on numeric columns, let's check below. If we want to operate on all columns it should be out of the if (length(t.n) > 0) condition
for (j in 1:ncol(temp.t)) {
temp.t[, j] <- sapply(t[, j],
if (j %in% t.n) {
temp.t[, j] <- sapply(t[, j],
format,
trim = TRUE,
digits = digits[j],
decimal.mark = decimal.mark,
big.mark = big.mark,
quote = FALSE)
} else
if (is.list(temp.t[, j])) {
temp.t[, j] <- list(lapply(t[, j],
format,
trim = TRUE,
digits = digits[j],
decimal.mark = decimal.mark,
big.mark = big.mark,
quote = FALSE))
}
}
}
}
Expand Down