I could not find a clear solution, so I would like to ask if there is some tool to count words (excluding R - latex code) in a .Rnw file. Thank you!

1 Answer 1


Not a direct answer to your question, but knitr::knit_filter() is a function to exclude R code from an Sweave document, and return a character vector that only contain the prose, of which you can count the words with other tools (such as wc).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.