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

How to use unicode strings with knitr on windows

这是一个简单的降价文件:

---
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 针织品,它们不起作用:

使用 unicode 而不是实际字符:

library(tidyverse)

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