Description Usage Arguments Details Value Examples
Counts words, characters and non-whitespace characters in R Markdown files.
1 |
files |
character: file name(s) |
space |
character: pattern to split a text at spaces (default: |
word |
character: pattern to split a text at word boundaries (default: |
It uses the following approaches to detect words, characters and non-whitespace characters.
strsplit(rmd, word)[[1]]
with word
equal to '[[:space:]]+'
strsplit(rmd, '')[[1]]
strsplit(gsub(space, '', rmd), '')[[1]]
with space
equal to '[[:space:]]'
This is repeated for the text without code chunks. Code chunks are deleted with gsub('```\\{.*?```', '', rmd)
.
a data frame wthe following elements
basename of a file
number of words including code chunks
number of characters including code chunks
number of non-whitespace characters including code chunks
number of words excluding code chunks
number of characters excluding code chunks
number of non-whitespace characters excluding code chunks
path of a file
1 2 3 4 5 6 | files <- system.file('rmarkdown/rstudio_pdf.Rmd', package="rmdwc")
rmdcount(files)
# use of rmdcount() in a R Markdown document
if (interactive()) {
file.edit(files) # SAVE(!) the file and knit it
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.