GT 表输出中缺少变音符号

发布于 2025-01-09 00:58:57 字数 1347 浏览 0 评论 0原文

我正在使用 R 中的 GT 包为我的文凭论文创建表格,但遇到了问题。文凭要用捷克语书写。

当 GT 绘制表格时,它不能正确显示字母 ě,而是显示 e。

GT 表的代码:

desc_sex[,2:ncol(desc_sex)] %>% gt(rowname_col = "sex"
  ) %>% tab_stubhead(
    label = html("Kategorie")
  ) %>% cols_align(
    align = "center",
    columns = everything()
  ) %>% cols_label(
    n = html("n"),
    procent = html("%")
  ) %>% tab_row_group(
    label = html("<b>Sledované regiony celkem"),
    rows = 7:9
  ) %>% tab_row_group(
    label = html("<b>Krajský soud v Ostravě"),
    rows = 4:6
  ) %>% tab_row_group(
    label = html("<b>Městský soud v Praze"),
    rows = 1:3
  ) %>% summary_rows(
    groups = T,
    fns = list(
      Celkem = ~sum(.)),
    formatter = fmt_number,
    decimals = 0
  )

以下是 CSV 兼容格式的数据:

"reg_reside","sex","n","procent","single"
"MSPH","Muž",93,46.5,52
"MSPH","Žena",83,41.5,34
"MSPH","Manželský pár",24,12,0
"KSOS","Muž",113,56.5,51
"KSOS","Žena",68,34,30
"KSOS","Manželský pár",19,9.5,0
"Celkem","Muž",206,51.5,103
"Celkem","Žena",151,37.8,64
"Celkem","Manželský pár",43,10.8,0

这是 GT 中的输出外观 - 错误出现在 Ostrave(应该是 Ostravě)和 Mestsky(应该是 Městský):

GT 的输出

I am using GT package in R to create tables for my diploma thesis and I ran into a problem. The diploma is to be written in the czech language.

When GT draws the table it does not display the letter ě properly and shows e instead.

The code for GT table:

desc_sex[,2:ncol(desc_sex)] %>% gt(rowname_col = "sex"
  ) %>% tab_stubhead(
    label = html("Kategorie")
  ) %>% cols_align(
    align = "center",
    columns = everything()
  ) %>% cols_label(
    n = html("n"),
    procent = html("%")
  ) %>% tab_row_group(
    label = html("<b>Sledované regiony celkem"),
    rows = 7:9
  ) %>% tab_row_group(
    label = html("<b>Krajský soud v Ostravě"),
    rows = 4:6
  ) %>% tab_row_group(
    label = html("<b>Městský soud v Praze"),
    rows = 1:3
  ) %>% summary_rows(
    groups = T,
    fns = list(
      Celkem = ~sum(.)),
    formatter = fmt_number,
    decimals = 0
  )

Here are the data in CSV compliant format:

"reg_reside","sex","n","procent","single"
"MSPH","Muž",93,46.5,52
"MSPH","Žena",83,41.5,34
"MSPH","Manželský pár",24,12,0
"KSOS","Muž",113,56.5,51
"KSOS","Žena",68,34,30
"KSOS","Manželský pár",19,9.5,0
"Celkem","Muž",206,51.5,103
"Celkem","Žena",151,37.8,64
"Celkem","Manželský pár",43,10.8,0

Here is how the output looks in GT - the mistake is in Ostrave (should be Ostravě) and Mestsky (should be Městský):

Output from GT

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱花细雨 2025-01-16 00:58:57

您可以尝试使用 ie ě = ě 等 html 实体

desc_sex[,2:ncol(desc_sex)] %>%
    gt(rowname_col = "sex") %>%
    tab_stubhead(label = html("Kategorie")) %>%
    cols_align(align = "center",columns = everything()) %>%
    cols_label(n = html("n"),
               procent = html("%")) %>%
    tab_row_group(label = html("<b>Sledované regiony celkem"),
                  rows = 7:9) %>%
    tab_row_group(label = html("<b>Krajský soud v Ostravě"),
                  rows = 4:6) %>%
    tab_row_group(label = html("<b>Městský soud v Praze"),
                  rows = 1:3) %>%
    summary_rows(groups = T,
                 fns = list(Celkem = ~sum(.)),
                 formatter = fmt_number,
                 decimals = 0)

You can try using html entities like i.e. ě = ě

desc_sex[,2:ncol(desc_sex)] %>%
    gt(rowname_col = "sex") %>%
    tab_stubhead(label = html("Kategorie")) %>%
    cols_align(align = "center",columns = everything()) %>%
    cols_label(n = html("n"),
               procent = html("%")) %>%
    tab_row_group(label = html("<b>Sledované regiony celkem"),
                  rows = 7:9) %>%
    tab_row_group(label = html("<b>Krajský soud v Ostravě"),
                  rows = 4:6) %>%
    tab_row_group(label = html("<b>Městský soud v Praze"),
                  rows = 1:3) %>%
    summary_rows(groups = T,
                 fns = list(Celkem = ~sum(.)),
                 formatter = fmt_number,
                 decimals = 0)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文