chunk | R Documentation |
chunk
takes a vector (or list) and returns a list of chunks
which all have lengths (approximately) equal to a specified value.
chunk(x, len = NULL, n = NULL)
x |
vector of list |
len |
target length of chunks |
n |
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
.
chunk(letters, 10)
chunk(LETTERS, n = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.