zip | R Documentation |
This function emulates Python's zip function. It expects a variable number of arguments. If a single vector/list x is passed the return value is a list of lists where each sub-list contains the components “key” and “value”. If x is named the key is the name, otherwise it is the element number. The value field unsuprisingly contains the corresponding value.
zip(...)
... |
[Lists/vectors] |
A list of lists.
x = list("a" = 1, "b" = 2, "c" = 3)
for (el in zip(x)) {
catf("Key: '%s', Value: %i\n", el$key, el$value)
}
z = zip(x, x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.