You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m trying to attach the same footnote to two column spanner labels and I discovered that the groups argument in cells_column_labels() seems to only take a single group. I’m not sure if this is intended behavior – the documentation doesn’t specify a limitation and the argument is plural rather than singular.
library(tidyverse)
library(gt)
Creating some simple example data with two spanner columns.
ex_gt %>%
tab_footnote(
footnote="Source: the definitive guide to the alphabet",
location= cells_column_labels(groups= c("A", "B"))
)
id
A
B
x
y
x
y
1
0.4559288
0.7890988
0.4918227
0.56427618
2
0.8617048
0.7735747
0.7332311
0.89511556
3
0.2775823
0.9261118
0.7178421
0.08071516
It also doesn’t work if the spanner column label is wrapped in c().
ex_gt %>%
tab_footnote(
footnote="Source: the definitive guide to the alphabet",
location= cells_column_labels(groups= c("A"))
)
id
A
B
x
y
x
y
1
0.4559288
0.7890988
0.4918227
0.56427618
2
0.8617048
0.7735747
0.7332311
0.89511556
3
0.2775823
0.9261118
0.7178421
0.08071516
But adding the footnote to a single column spanner group works.
ex_gt %>%
tab_footnote(
footnote="Source: the definitive guide to the alphabet",
location= cells_column_labels(groups="A")
) %>%
tab_footnote(
footnote="Source: the definitive guide to the alphabet",
location= cells_column_labels(groups="B")
)
id
A1
B1
x
y
x
y
1
0.4559288
0.7890988
0.4918227
0.56427618
2
0.8617048
0.7735747
0.7332311
0.89511556
3
0.2775823
0.9261118
0.7178421
0.08071516
1 Source: the definitive guide to the alphabet
I expected groups to operate in the same way as the columns argument of cells_column_labels().
Thanks for illustrating the problem so clearly with the examples. The groups argument in cells_column_labels() should ideally be able to take multiple groups, so, this needs a fix.
However, vars(A, B) doesn't work (Error: Column grpname can't be converted from character to quosures), and the select helpers like everything(), starts_with(...) don't work (Error: No tidyselect variables were registered).
I’m trying to attach the same footnote to two column spanner labels and I discovered that the
groups
argument incells_column_labels()
seems to only take a single group. I’m not sure if this is intended behavior – the documentation doesn’t specify a limitation and the argument is plural rather than singular.Creating some simple example data with two spanner columns.
Referencing the spanner columns as
c("A", "B")
doesn’t work.id
A
B
x
y
x
y
1
0.4559288
0.7890988
0.4918227
0.56427618
2
0.8617048
0.7735747
0.7332311
0.89511556
3
0.2775823
0.9261118
0.7178421
0.08071516
It also doesn’t work if the spanner column label is wrapped in
c()
.id
A
B
x
y
x
y
1
0.4559288
0.7890988
0.4918227
0.56427618
2
0.8617048
0.7735747
0.7332311
0.89511556
3
0.2775823
0.9261118
0.7178421
0.08071516
But adding the footnote to a single column spanner group works.
id
A1
B1
x
y
x
y
1
0.4559288
0.7890988
0.4918227
0.56427618
2
0.8617048
0.7735747
0.7332311
0.89511556
3
0.2775823
0.9261118
0.7178421
0.08071516
1 Source: the definitive guide to the alphabet
I expected
groups
to operate in the same way as thecolumns
argument ofcells_column_labels()
.id
A
B
x1
y
x1
y
1
0.4559288
0.7890988
0.4918227
0.56427618
2
0.8617048
0.7735747
0.7332311
0.89511556
3
0.2775823
0.9261118
0.7178421
0.08071516
1 Source: randomness
Created on 2019-03-20 by the reprex package (v0.2.1)
Session info
The text was updated successfully, but these errors were encountered: