Extract only text from Rmd documents
问题 Not even sure if this is possible, but is there a way to extract only the raw text portion of the .Rmd file and discard any code? Or basically converting an .Rmd file into .txt file within R? I've tried the function readLines , but this makes a huuuuuge character with all kinds of (to me) useless meta-data. 回答1: You can knit document without evaluating and including code. Here's an example of dummy document foo.Rmd : # Header 1 foo ## Header 2 bar ## Header 22 foobar ```{r} 1 ``` text text