Learn R Programming

hyphenatr (version 0.3.0)

hyphenate: Hyphenate a character vector of words

Description

Given a character vector (one word per element), this function will hyphenate the strings or return a list of separated hyphenated string components.

Usage

hyphenate(words, simplify = TRUE)

Arguments

words
character vector of words
simplify
if TRUE, will return words with = as the hyphen character. If FALSE, will return a list of separated, hyphenated word components. If a string (e.g. "-", "­" or '­") will use that character for the hyphen character.)

Value

a character vector or a list depending on the value of simplify.

Examples

Run this code
dat <- readLines(system.file("extdata/top10000en.txt", package="hyphenatr"))

out1 <- hyphenate(dat)
out2 <- hyphenate(dat, simplify=FALSE)
out3 <- hyphenate(dat, simplify="-")
out4 <- hyphenate(dat, simplify="­")

Run the code above in your browser using DataLab