combineCols {toolbox} | R Documentation |
Combine columns of a list/data frame into a list by row
Description
Combine columns of a list/data frame into a list by row
Usage
combineCols(x, cols = NULL, by_name = FALSE, parallel = FALSE, cores = 1)
Arguments
x |
A list or data frame. |
cols |
An optional vector of column positions or names to combine together. If passing column names, set by_name to TRUE. The order of items in cols determines the order of the combined result. |
by_name |
Boolean, if TRUE, it quotes the items in cols to properly index the list by name (x[[1]] vs x[["col_a"]]). |
parallel |
Boolean, if TRUE, attempts to use mclapply. |
cores |
An integer, the number of cores to use if parallel is TRUE. |
Value
A list of the values in each column combined together for each row.
Examples
combineCols(list("x" = c(1, 2, 3), "y" = c("a", "b", "c")))
[Package toolbox version 0.1.1 Index]