Last chance! 50% off unlimited learning
Sale ends in
chunk
takes a vector (or list) and returns a list of chunks
of (approximately) equal to a specified length.
chunk(x, len = NULL, n = NULL)
vector of list
target length of chunks
number of chunks
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
.
# NOT RUN {
chunk(letters, 10)
chunk(LETTERS, n = 3)
# }
Run the code above in your browser using DataLab