s <- c("space at end ", " white at begin", " both ", " special ^ ")
removeSpace(s)
trimws(s)
# To add space, use:
x <- c("ab","abcde")
format(x)
format(x, justify="centre")
format(x, width=9)
Run the code above in your browser using DataLab