R - trim strings with strtrim()

25 Dec 2018

Use of strtrim for trimming character vectors to specified display widths:

### Trim character strings to specified display widths.
strtrim(month.name, 3)
#  [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov"
# [12] "Dec"

See also trimws to trim leading and trailing whitespaces.

[ R  strings  function  ]