x,
which contains white spaces, the string is made into a paragraph.
Empty lines also delineate paragraphs.
strwrap(x, width=0.9 * options()$width, indent=0, exdent=0, prefix="", simplify=TRUE)
indent is
null,
and
exdent is not
null, the
result is a hanging indented paragraph.)
TRUE produces a single character
vector of line text. Otherwise, it produces a list of the same length as
x. In this case, the elements of the resulting list are
character vectors of the line text obtained from the corresponding element of
x.
Any white space contained in the input is removed. Double spaces after periods are retained.
## Read in file 'FIXEDBUG.TXT'. docdir <- "doc" # set to "help" on Windows x <- paste(readLines(file.path(system.file(), docdir, "FIXEDBUG.TXT")), collapse = "\n") ## Split into paragraphs x <- unlist(strsplit(x, "\n[ \t\n]*\n")) ## Join the rest x <- paste(x, collapse = "\n\n") ## Now for some fun: writeLines(strwrap(x, width = 60)) writeLines(strwrap(x, width = 60, indent = 5)) writeLines(strwrap(x, width = 60, exdent = 5)) writeLines(strwrap(x, prefix = "FIXED> "))