chunk_data_ | R Documentation |
Creates a factory function which returns a different chunk of a given data object with each function call.
chunk_data_(x, size = 10, reverse = FALSE)
x |
A data frame or vector. |
size |
An integer. The number of items (e.g. rows in a tibble) that make up a given chunk. Must be a positive integer. |
reverse |
A logical. Calculate chunks from back to front. |
A factory function which returns a chunk of data from the provided object with each call. Once all data has been returned, function returns NULL perpetually.
# Create chunk factory function chunked_data <- chunk_data_(mtcars, size = 6) # Chunk #1 (rows 1-6) paste0(rownames(chunked_data()), collapse = ', ') # Chunk #2 (rows 7-12) paste0(rownames(chunked_data()), collapse = ', ')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.