Skip to content
Prev 360955 / 398506 Next

break string at specified possitions

Here are two ways that do not use any packages:

s <- paste(letters, collapse = "") # test input

substring(s, first, last)
## [1] "abcde"     "fghij"     "klmnopqrs"


read.fwf(textConnection(s), last - first + 1)
##         V1    V2        V3
## 1 abcde fghij klmnopqrs
On Wed, May 11, 2016 at 4:12 PM, Jan Kacaba <jan.kacaba at gmail.com> wrote: