Добавьте results='asis'
в кусок и поместите print()
вокруг kable()
.
#```{r, results='asis'}
library("data.table") # Extension of data frame object functionality, get help with command: library(help = "data.table")
library(knitr) # Library for displaying tables in markdown
txtA <- "TEXT A TEXT A"
txtB <- "TEXT B TEXT B"
tabA <- data.table(High=c(125,250,360),
Low=c(19,9,36),
Middle=c(55,70,67))
n1 <- 1
n2 <- 1
if (n1+n2!= 0) {
if (n1!=0) {
cat(paste0("\n","**",txtA,"**"))
print(kable(tabA))
}
if (n2!=0) {
cat(paste0("\n","**",txtB,"**"))
print(kable(tabA))
}
}
#```
Или разделите две таблицы на два отдельных куска.
#```{r}
if (n1+n2!= 0) {
if (n1!=0) {
cat(paste0("\n","**",txtA,"**"))
kable(tabA)
}
}
#```
#```{r}
if (n1+n2!= 0) {
if (n2!=0) {
cat(paste0("\n","**",txtB,"**"))
kable(tabA)
}
}
#```