word_count: Break lines of an input file

View source: R/word_count.R View source: R/break_lines.R

word_countR Documentation

Break lines of an input file

Description

Function to break lines at a specified width. Finds nearest white space to 80 characters and breaks the line there.

Function to count words in an Rmd file. YAML headers and Code Chunks are ignored and optional lines to skip can be included.

Usage

word_count(txtfile, skip_lines = NULL)

word_count(txtfile, skip_lines = NULL)

Arguments

txtfile

path and filename of a file to count the words

skip_lines

a numeric vector indicating lines of the file to skip. These lines are removed prior to removing YAML and code chunks. Default is NULL.

outfile

Output file to save

width

integer indicating width at which to set line break. Defaults to 80 characters.

yaml

Logical indicating whether or not YAML should be included. Not yet implemented.

chunks

Logical indicating whether or not code chunks should be included. Not yet implemented.

Examples

my_file <- system.file('extdata/test.Rmd',package='miscPackage')
word_count(my_file)
#@export
my_file <- system.file('extdata/test.Rmd',package='miscPackage')
word_count(my_file)

jhollist/miscPackage documentation built on Nov. 26, 2024, 5:34 p.m.