Count Words and Characters in R Markdown and Jupyter Notebooks

Computes word, character, and non-whitespace character counts in R Markdown documents and Jupyter notebooks, with or without code chunks. Returns results as a data frame.


rmdwc

If you are using R Markdown documents then you have sometimes restrictions about the size of the documents, e.g. number of words, number of characters or non-whitespace characters. rmdcount computes these counts and returns the result as data frame.

## Count the number of words, number of characters or non-whitespace characters of files
library("rmdwc")
files <- system.file('rmarkdown/rstudio_pdf.Rmd', package="rmdwc")
rmdcount(files) # exclude code chunks
txtcount(files) # include code chunks

## Within a R Markdown document in a code chunk
# ```{r}
# library("rmdwc")
# rmdcount()
# ```

## After loading the library go in RStudio to "Addins" -> RMDWC
# If the current document is a R Markdown file then it will count and send the result to the console

Installation

From CRAN

install.packages("rmdwc")

From github

Note that from github you install the current development version.

library("devtools")
install_github("sigbertklinke/rmdwc")

History

  • 12 Nov 2022 - Added the RStudio addin

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rmdwc")

0.3.1 by Sigbert Klinke, a year ago


https://github.com/sigbertklinke/rmdwc


Browse source code at https://github.com/cran/rmdwc


Authors: Sigbert Klinke [aut, cre]


Documentation:   PDF Manual  


GPL-3 license


Imports jsonlite, knitr, rstudioapi

Suggests testthat


See at CRAN