Skip to content

Commit

Permalink
force NA to be "NA" as nchar API changed on 2015-04-23 in R-devel
Browse files Browse the repository at this point in the history
  • Loading branch information
daroczig committed May 16, 2015
1 parent c7a177d commit 87e29b4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/pandoc.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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))
}
Expand Down

0 comments on commit 87e29b4

Please sign in to comment.