r - 如何在 windows 上使用带有 knitr 的 unicode 字符串

标签 r knitr

这是一个简单的 Markdown 文件:

---
title: "blah"
output: html_document
---

```{r}
library(tidyverse)

ggplot(tibble(x=1:2)) +
  aes(x=x, y=x) +
  geom_col() +
  labs(y = "← low      high →")
```

注意箭头。它们在通过控制台运行代码到 RStudio 的绘图选项卡时显示。但是对于 HTML 编织,它们不起作用:

enter image description here

最佳答案

使用 unicode 而不是实际字符:

library(tidyverse)

ggplot(tibble(x=1:2)) +
  aes(x=x, y=x) +
  geom_col() +
  labs(y = "\u2190 low      high \u2192")

enter image description here

关于r - 如何在 windows 上使用带有 knitr 的 unicode 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50336304/

相关文章:

r - 如何在 R Markdown 笔记本中显示 kable kableExtra 表,而不仅仅是在针织文档中?

r - 将多种日期时间格式转换为一种标准格式

r - 传单未在动态生成的 R markdown html knitr 中呈现

r - 如何在R中将向量转换为具有已知嵌套结构的列表?

浏览器中的 RStudio "next line"命令()不起作用

r - 将点 (graphviz) 代码作为字符串返回的 Knit 函数

r - knitr、RGL 和 legend3d : legend3d didn't show up in the html generated by knitr

r - 使用knitr绘制图的位置

r - 快速替换 NA - 错误或警告

r - knit2pdf 可以使用全局环境吗?