Skip to content

Instantly share code, notes, and snippets.

@ezmiller
Created August 22, 2016 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ezmiller/6e24456d07819419980263080235090d to your computer and use it in GitHub Desktop.
Save ezmiller/6e24456d07819419980263080235090d to your computer and use it in GitHub Desktop.
R function for wrapping long strings
## Function to wrap long strings
# Source: http://stackoverflow.com/a/7367534/496488
wrap_strings <- function(vector_of_strings,width) {
as.character(
sapply(vector_of_strings, FUN=function(x) {
paste(strwrap(x, width=width), collapse="\n")
})
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment