str_slice2: Slice a Vector at Consecutive Indices

Description Usage Arguments Value Note See Also

View source: R/str_slice.R

Description

This function 'slices' the strings of a character vector x at consecutive indices n, thereby generating consecutive substrings of length n and returning the result as a list. This function will safely 'slice' a UTF-8 encoded vector.

Usage

1
str_slice2(x, n = 1, USE.NAMES = TRUE)

Arguments

x

a character vector.

n

integer (or numeric coercible to integer); index at which to slice.

USE.NAMES

logical. if names attribute already exists on x, pass this through to the result?

Value

A list of length equal to the length of x, with each element made up of the substrings generated from x[i].

Note

Safe for use with UTF-8 characters, but slower than str_slice.

See Also

str_slice, for slicing an ASCII vector.


Kmisc documentation built on May 29, 2017, 1:43 p.m.

Related to str_slice2 in Kmisc...