alter_column_names: Alter column names of a grob matrix

Description Usage Arguments Details Value Examples

View source: R/headings.R

Description

Alter column names of an object initialized by grob_matrix.

Usage

1
2
3
4
5
6
alter_column_names(
  mat,
  column_names = list(),
  column_name_cols = list(),
  group_elements = TRUE
)

Arguments

mat

The grob matrix object the column names will be edited in.

column_names

The replacement column names, in a list with each column name a separate element. The list must have the same amount of elements as the column_name_cols parameter.

column_name_cols

Which column positions of the initial data frame / matrix the column_names will replace, in a list with each column name's column positions a separate element. The list must have the same amount of elements as the column_names parameter.

Can either be numeric indices, or column names of the initial data frame / matrix passed through grob_matrix.

Default is an empty list. If unaltered, the function will assume the user wants to apply column_names to all columns of the grob_matrix - in which case only one column_names is allowed.

group_elements

A boolean argument on whether like, adjacent column names should be grouped together.

Details

The user can only use this function if the initial data frame / matrix passed through grob_matrix had column names to begin with.

The underlying column names will be unaffected. So, if the user wants to use alter_at afterwards, he/she should select the original column names and not the replacements from this function.

Value

The initial grob matrix object with column names edited in the appropriate areas.

Examples

1
2
3
4
data.frame(var1 = c(5, 14, 6, 10), var2 = c(3, 30, 17, 7)) %>%
  grob_matrix() %>% 
  alter_column_names(c('COLUMN NAME')) %>%
  view_grob()

grobblR documentation built on Sept. 15, 2021, 1:07 a.m.