The function stringr::str_wrap()
is highly efficient, but in the
context of table creation there are two select features missing - hyphenation
for long running strings that overflow width, and respect for pre-indentation
of a character element. For example, in an adverse event table, you may have
body system rows as an un-indented column, and preferred terms as indented
columns. These strings may run long and require wrapping to not surpass the
column width. Furthermore, for crowded tables a single word may be longer
than the column width itself.
This function takes steps to resolve these two issues, while trying to
minimize additional overhead required to apply the wrapping of strings.
Note: This function automatically converts tabs to spaces. Tab width varies
depending on font, so width cannot automatically be determined within a data
frame. As such, users can specify the width