add_column_headings: Add column headings to grob matrix

Description Usage Arguments Details Value Examples

View source: R/headings.R

Description

Add column headings onto an object initialized by grob_matrix.

Usage

1
add_column_headings(mat, headings = list(), heading_cols = list())

Arguments

mat

The grob matrix object the column headings will be added onto.

headings

The headings to be added onto the initial matrix, in a list with each heading a separate element. The list must have the same amount of elements as the heading_cols parameter.

heading_cols

Which column positions of the initial matrix the headings will be placed above, in a list with each heading's column positions a separate element. The list must have the same amount of elements as the headings 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 headings to all columns of the grob_matrix - in which case only one headings is allowed.

Details

The user must add column headings before adding or altering any aesthetics.

Value

The initial grob matrix object with column headings inserted into the appropriate areas.

Examples

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

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