chunk {ngramr} | R Documentation |
Chunk a vector or list
Description
chunk
takes a vector (or list) and returns a list of chunks
which all have lengths (approximately) equal to a specified value.
Usage
chunk(x, len = NULL, n = NULL)
Arguments
x |
vector of list |
len |
target length of chunks |
n |
number of chunks |
Details
If n
is specified, len
is ignored and chunk
returns
a list of length n
of "chunks" of x
. Otherwise
n
is calculated to break the vector into chunks which are
each approximately of length len
. If both len
and
n
are unspecified, chunk
simply returns x
.
Examples
chunk(letters, 10)
chunk(LETTERS, n = 3)
[Package ngramr version 1.9.3 Index]