How to use an object rather than a file as source for knitting [resolved]

Thanks, this works great. It even recognizes objects previously declared.

a <- 1:5
markobj <- c('---',
             'title: "test"',
             'output: html_document',
             '---',
             '',
             '## R Markdown',
             '',
             'This is an R Markdown document.',
             '```{r}',
             'b <- 11:15',
             'print(a)',
             'print(b)',
             '```')

markdown::markdownToHTML(text = knitr::knit(text = markobj), output = 'test.html')

browseURL("test.html")
2 Likes