rmarkDown Backticks内联代码 /与通常的代码块不一致的行为不一致
这在R Markdown中的通常代码块中起作用:
m1_aov <- anova(m1)
m1_aov$`Sum Sq`[2] %>% round(3)
不幸的是,使用内联代码中的后者破坏了knitr
解析器
`r m1_aov$`Sum Sq`[2] %>% round(3)`
确实会破坏stackoverflow。
我看着这个相关问题,但无法推断出我的问题的工作解决方案。有暗示吗?
This works in a usual code chunk in R markdown:
m1_aov <- anova(m1)
m1_aovThis works in a usual code chunk in R markdown:
Sum Sq`[2] %>% round(3)
Unfortunately, using the latter in inline code breaks the knitr
parser down
`r m1_aovThis works in a usual code chunk in R markdown:
m1_aov <- anova(m1)
m1_aovThis works in a usual code chunk in R markdown:
Sum Sq`[2] %>% round(3)
Unfortunately, using the latter in inline code breaks the knitr
parser down
Sum Sq`[2] %>% round(3)`
Indeed, it also breaks Stackoverflow.
I looked at this related question but could not infer a working solution to my problem. Any hint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
用一个工作的示例扩展评论:
对我来说,这看起来像是一个整洁的技巧,因为它避免在文本中包含不必要的长代码,并且不要以创建新对象的(小)成本来创建您面临的问题。
输出:

Expanding the comment with a working example:
To me this looks like a neat trick because it avoids to include unecessary long code inside the text, and do not create the problem you are facing at the (small) cost of creating new objects.
The output:
