Reputation: 401
I am generating an HTML report using rmarkdown. I want to pass the list of the tables through render
method but it's throwing me an error:
Error in UseMethod("as.html") :
no applicable method for 'as.html' applied to an object of class "character"
Code Snippet:
---
params:
tables: !r
---
```{r results='asis', echo=FALSE}
for(i in as.list(params$tables)){
cat("######", as.html(i), "\n")
}
```
Please suggest a way to resolve.
Thank you for the help!
Upvotes: 1
Views: 1261
Reputation: 10215
Provide a default for tables, e.g
tables: !r "whatever"
I could not find the requirement in the docs, but it looks like an empty string such as "" does not work.
Add a reference to htmltools
library(htmltools)
There is no function as.html, only HTML in htmltools or shiny:
HTML(i)
Upvotes: 1