The "emphasize.strong.rows" function fails when there are no rows to emphasize. Example:
#this works
iris
iris_b <- iris[1:3, ]
emphasize.strong.rows (which(iris_b$Sepal.Width > 3))
pandoc.table(iris_b)
#this fails to work
iris
iris_b <- iris[1:3, ]
emphasize.strong.rows (which(iris_b$Sepal.Width > 4))
pandoc.table(iris_b)
Error message: Error in apply(t, c(1, 2), function(x) gsub("[[:space:]]*$", "", x)) : dim(X) must have a positive length
Any ideas on how to get this to work? I am trying to highlight specific rows in Rmarkdown (MS Word output)
You may use it with an if
condition to check if at least one row satisfies the condition.
library(pander)
iris_b <- iris[1:3, ]
condition <- which(iris_b$Sepal.Width > 3)
if(length(condition)) emphasize.strong.rows(condition)
pandoc.table(iris_b)