https://cran.r-project.org/web/packages/knitr/vignettes/knit_print.html

(l1 <- list(a = c(1, 2), b = list(x = 3, y = 'AAA')))
## $a
## [1] 1 2
## 
## $b
## $b$x
## [1] 3
## 
## $b$y
## [1] "AAA"
head(iris)
##   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1          5.1         3.5          1.4         0.2  setosa
## 2          4.9         3.0          1.4         0.2  setosa
## 3          4.7         3.2          1.3         0.2  setosa
## 4          4.6         3.1          1.5         0.2  setosa
## 5          5.0         3.6          1.4         0.2  setosa
## 6          5.4         3.9          1.7         0.4  setosa
library(knitr)

library(Hmisc)
knit_print.list <- function(x, ...) {
  list.tree(x)
}

library(xtable)
knit_print.data.frame <- function(x, ...) {
  print(xtable(x), type='html')
}
# keep chunk option default (`results = "markup"`)
l1
##  x = list 2 (840 bytes)
## .  a = double 2= 1 2
## .  b = list 2
## . .  x = double 1= 3
## . .  y = character 1= AAA
# specify chunk option `results = "asis"`
head(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.10 3.50 1.40 0.20 setosa
2 4.90 3.00 1.40 0.20 setosa
3 4.70 3.20 1.30 0.20 setosa
4 4.60 3.10 1.50 0.20 setosa
5 5.00 3.60 1.40 0.20 setosa
6 5.40 3.90 1.70 0.40 setosa