I have seen a number of similar questions relating to line breaks in expressions, but I'm still not able to get a table with an expression and line break in the header.
I would like it to say Model R2 on the top line, and Mean (95% CIs) on the second line.
Here is what I've tried. I've removed the % sign which seemed to add additional problems.
library(ggpmisc)
library(tidyverse)
data <- tibble(
"Mean" = c(1:4),
"R^2" = c(5:8),
"Model~R^2~Mean~(CIs)" = c(5:8),
"atop('Model~R^2',\n,'Mean~(CIs)')" = c(5:8),
"Model~R^2,\nMean~(CIs)" = c(5:8),
"Model~R^2\nMean~(CIs)" = c(5:8)
)
df <- tibble(x = 1, y = 1, tb = list(data))
starwars %>%
ggplot(aes(height, mass)) +
geom_point()+
geom_table_npc(data = df, aes(label = list(data)),
table.theme = ttheme_gtlight( parse = T),
npcx = 0.5, npcy = 0.5, size = 5)