Description Usage Arguments Value Examples
Flexibly alter the aesthetic / structure of a grob matrix object at specific points of the data.frame/matrix.
1 2 3 4 5 6 7 8 9 10 11 |
grob_object |
The R6 grob object class initialized by |
.f |
A quosure style lambda |
... |
Logical predicates defined in terms of the variables in the initial
data frame / matrix, or if the user provides a new data.frame to evaluate via
If no logical predicates provided, then the entire columns will be altered. |
columns |
A character vector of column names, or numeric column indices,
of the initial data.frame/matrix, or |
rows |
A numeric vector of row indices, of the initial data.frame/matrix,
or Ignored if the user is altering a structure and not an aesthetic. |
data |
A separate data.frame/matrix of the same dimensions as the initial
data.frame/matrix which the Must match the dimensions of the subset of the initial data.frame/matrix the user is attempting to alter. Ignored if the user is altering a structure and not an aesthetic. |
structure |
Which structure the user wants to make alterations to. If left
View the documentation of |
aesthetic |
Which aesthetic the user wants to make alterations to. If left
View the documentation of |
group |
Which group of elements the user wants to make alterations to. If left
|
The R6 grob matrix object class with its aesthetic / structure properties altered.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | df = data.frame(var1 = c(5, 14, 6, 10), var2 = c(3, 30, 17, 7))
df %>%
grob_matrix() %>%
add_aesthetic(aesthetic = 'text_color', group = 'cells', value = 'red') %>%
alter_at(
.f = ~ 'blue',
abs(var2 - var1) > 1
) %>%
view_grob()
test_function = function(x) ifelse(x > 15, 2, 1)
df %>%
grob_matrix() %>%
alter_at(
.f = ~ test_function(.),
aesthetic = 'font_face',
group = 'cells'
) %>%
view_grob()
df %>%
grob_matrix() %>%
add_structure("column_widths_p", 1) %>%
alter_at(
.f = ~ 2,
columns = 1
) %>%
view_grob()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.