Could someone please explain why in the Rmd code (to generate a HTML report using RStudio) below only the cat
command is being displayed? When I move the cat
command outside the if
clause or comment it out the table is printed. I believe the same thing happens when using library(printr)
, but I haven't confirmed this with a minimal sample.
It seems that the code inside the if
clause is somehow interpreted together and that the cat
doesn't go well with the datatable
.
If you could give me some clues on how to debug this, it would be helpful, too. As there are no warnings/error messages anywere.
---
title: "test"
output:
html_document
---
```{r}
if(TRUE){
DT::datatable(iris)
cat("I am here with my cat")
}
```