Skip to contents

This function takes a path to a .Rmd file and returns a word count. For best results each sentence should start on a new line. Inline code chunks should also start on a new line.

Usage

count_words(file)

count_words2(file)

Arguments

file

A path to a .Rmd file

Value

A scalar representing the number of words in the document.

Examples

rmarkdown::draft(file = "test", template = "html_vignette",
package = "rmarkdown", create_dir = TRUE, edit = FALSE)
iheiddown::count_words("test/test.Rmd")
#> [1] 241
unlink("test", recursive = TRUE)