[R] UNIX-like "cut" command in R
Mike Miller
mbmiller+l at gmail.com
Tue May 3 08:04:50 CEST 2011
On Mon, 2 May 2011, P Ehlers wrote:
> Use str_sub() in the stringr package:
>
> require(stringr) # install first if necessary
> s <- "abcdefghijklmnopqrstuvwxyz"
>
> str_sub(s, c(1,12,17), c(3,15,-1))
> #[1] "abc" "lmno" "qrstuvwxyz"
Thanks. That's very close to what I'm looking for, but it seems to
correspond to "cut -c", not to "cut -f". Can it work with delimiters or
only with character counts?
Mike
More information about the R-help
mailing list