df_to_blocks {turner} | R Documentation |
Split a data frame into blocks
Description
Split a data frame into a list of blocks (either by rows or by columns)
Usage
df_to_blocks(DataFrame, blocks, byrow = TRUE)
Arguments
DataFrame |
a data frame to split |
blocks |
either a list or a vector indicating the
blocks. If |
byrow |
logical. If |
Value
A list of data frames
Author(s)
Gaston Sanchez
See Also
Examples
# say you have a data frame
iris_df = iris[c(1:3,51:53,101:103),]
# list defining the blocks
row_blocks = list(1:3, 4:6, 7:9)
col_blocks = c(2, 2, 1)
# split data into list of blocks (by rows)
df_to_blocks(iris_df, row_blocks)
# split data into list of blocks (by columns)
df_to_blocks(iris_df, col_blocks, byrow=FALSE)
[Package turner version 0.1.9 Index]