我正在尝试使用 R markdown 文档中的 library(emo) 作为 gt 表的一部分来获取国家/地区标志。下面是我的代码,当我编织文档时,我看到的是国家的 ASCII 代码而不是标志,不确定出了什么问题
library(tidyverse)
library(gt)
library(emo)
df <-data.frame(
stringsAsFactors = FALSE,
Country = c("Health sciences",
"Physical sciences","Engineering",
"Computer science, maths","% of women inventores"),
Japan = c(0.24, 0.11, 0.11, 0.11, 0.08),
Chile = c(0.43, 0.23, 0.22, 0.16, 0.19),
United.Kingdom = c(0.45, 0.21, 0.22, 0.21, 0.12),
United.States = c(0.46, 0.2, 0.22, 0.22, 0.14),
Mexico = c(0.46, 0.25, 0.26, 0.22, 0.18),
Denmark = c(0.47, 0.22, 0.23, 0.18, 0.13),
EU28 = c(0.48, 0.25, 0.25, 0.22, 0.12),
France = c(0.48, 0.24, 0.25, 0.22, 0.17),
Canada = c(0.49, 0.21, 0.22, 0.22, 0.13),
Australia = c(0.5, 0.23, 0.25, 0.24, 0.12),
Brazil = c(0.57, 0.33, 0.32, 0.24, 0.19),
Portugal = c(0.57, 0.37, 0.36, 0.27, 0.26)
)
生成 gt 表的代码仍然没有在输出中标记
df %>%
gt() %>%
cols_label(Country="Department" ,
Japan=paste0("Japan",emo::ji("jp")),
Chile=paste0(emo::ji("chile")),
United.Kingdom=paste0(emo::ji("uk")),
United.States=paste0(emo::ji("us")),
Mexico=paste0(emo::ji("mexico")),
Denmark=paste0(emo::ji("denmark")),
EU28=paste0(emo::ji("eu")),
France=paste0(emo::ji("france")),
Canada=paste0(emo::ji("canada")),
Australia=paste0(emo::ji("australia")),
Brazil=paste0(emo::ji("brazil")),
Portugal=paste0(emo::ji("portugal")))