From 87e29b49fc2856ceadc84cd9e7c5cc58e0b68708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gergely=20Dar=C3=B3czi?= Date: Sat, 16 May 2015 14:23:08 -0700 Subject: [PATCH] force NA to be "NA" as nchar API changed on 2015-04-23 in R-devel https://stat.ethz.ch/pipermail/r-devel/2015-April/071007.html --- R/pandoc.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/pandoc.R b/R/pandoc.R index cb581a81..3b7c5ec9 100644 --- a/R/pandoc.R +++ b/R/pandoc.R @@ -610,6 +610,10 @@ pandoc.table.return <- function(t, caption, digits = panderOptions('digits'), de split.single.cell <- function(x, max.width){ if (!is.character(x)) x <- as.character(x) + ## as.character(NA) remains NA, which causes isses with nchar since 2015-04-23 + ## https://stat.ethz.ch/pipermail/r-devel/2015-April/071007.html + if (is.na(x)) + x <- 'NA' if (!style %in% c('simple', 'rmarkdown')) { ## split if (nchar(x) == nchar(encodeString(x)) && !use.hyphening) { @@ -971,8 +975,8 @@ pandoc.table.return <- function(t, caption, digits = panderOptions('digits'), de if (all (strsplit(justify, "")[[1]] %in% c("c", "l", "r") )) { if (nchar(justify) != length(t.width)) stop(sprintf('Wrong number of parameters (%s instead of *%s*) passed: justify', nchar(justify), length(t.width))) - - justify <- c(l = "left", c = "centre", r = "right")[ strsplit(justify, "")[[1]] ] + + justify <- c(l = "left", c = "centre", r = "right")[ strsplit(justify, "")[[1]] ] } else { justify <- rep(justify, length(t.width)) }