我正在尝试使用gganimate
覆盖90年的数据集来创建GIF ,即我希望GIF运行90个州/年.然而,似乎gganimate
只能处理不到50个州.
所以这是一个例子:
library(tidyverse)
# devtools::install_github('thomasp85/gganimate')
library(gganimate)
df = expand.grid( x = 1,
y = c(2,3),
year = 1670:1760) %>% mutate( z = 0.03* year,
u = .2 * year)
Run Code Online (Sandbox Code Playgroud)
这一切都运作49年:
ggplot(data=df %>% filter(., year %in% 1670:1719) , aes()) +
geom_point( aes(x = x, y = y, fill = z, size = u), shape = 21 ) +
labs( title = 'Year: {closest_state}') +
enter_appear() +
transition_states(year, transition_length = 1, state_length = 2)
Run Code Online (Sandbox Code Playgroud)
然而,当我包括50(或更多)年时,它变得奇怪:
ggplot(data=df %>% …
Run Code Online (Sandbox Code Playgroud) 使用 quarto 的 HMTL 输出功能,我尝试从 data.frame 生成一个 kable,其中包含一些应显示在最终文档中的 Markdown 样式格式。在实际用例中,我有许多文档已经以这种方式格式化,我想重新使用这些命令来正确呈现输出。
这是我的example.qmd:
---
title: "example"
format:
html
---
```{r setup}
library(kableExtra)
```
```{r}
#| echo: false
data.frame(Function = "`read_delim()`",
Formula = "$\\leftarrow$",
Break = "this continues on a<br>new line",
Link = "[Google](www.google.com)") |>
kbl(format = "html")
```
Run Code Online (Sandbox Code Playgroud)
运行该块后,RStudio 中的预览确实正确显示了箭头和换行符,但 ` ` 和链接无法生效:
将 qmd 渲染为 HTML 时,结果如下所示,即忽略格式:
我缺少什么?将四开文档渲染为 HTML 时,有没有办法将此类格式化命令包含到 kable 中?