stack_into_n_columns | R Documentation |
Reshapes the data to an n column structure for easy use in documents. Pads empty lines between variables and can include their names as well. Outputs a character matrix.
stack_into_n_columns(
data,
columns,
pad_columns = TRUE,
include_colnames = TRUE,
rowname_colnames = "name"
)
data |
(data.frame, matrix, or something coercible into a matrix) The data to reshape. |
columns |
(whole number scalar) How many columns to stack the data into. |
pad_columns |
(logical) Whether to pad empty columns to the data if the data and column dimensions do fit divide into a whole number. Defaults to TRUE. |
include_colnames |
(logical) Whether to include the column names in the output. Defaults to TRUE. |
rownames_colnames |
(character scalar) If adding colnames in rows, which rownames should these be given? Defaults to "name". |
df = split_every_k(1:12, 2) %>% as.data.frame
stack_into_n_columns(df, 2)
stack_into_n_columns(df, 3)
stack_into_n_columns(df, 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.