评估存储在R-MarkDown中R对象中的HTML脚本
在rmarkDown
中,如何实现/评估一些html
存储在r
字符对象中的代码?
如果我将代码明确粘贴为纯文本,则可以按预期工作,例如,详细信息> smumary> show/hide。</summary> woryext&lt ext</delect> 。
但是,我需要从R对象进行评估。例如,如何评估text
对象的内容:text< - '<详细信息>摘要> show/hide。</summary> woryext> /代码>?
以下是reprex。
谢谢,艾哈迈德
---
title: "Literature notes"
output:
html_document:
#code_folding: hide
---
<details><summary>Show/hide.</summary>SomeText</details> # This works
```{r, eval=TRUE, echo=F}
Text <- '<details><summary>Show/hide.</summary>SomeText</details>'
Text
## how to do the same using info stored in 'Text' object
```
In Rmarkdown
, how can I implement/evaluate some HTML
code stored in an R
character object?
If I explicitly paste the code as plain text, it works as expected e.g. <details><summary>Show/hide.</summary>SomeText</details>
.
However, I need to evaluate this from an R object; e.g. how to evaluate the content of the Text
object: Text <- '<details><summary>Show/hide.</summary>SomeText</details>'
?
Below is a reprex.
Thanks, Ahmed
---
title: "Literature notes"
output:
html_document:
#code_folding: hide
---
<details><summary>Show/hide.</summary>SomeText</details> # This works
```{r, eval=TRUE, echo=F}
Text <- '<details><summary>Show/hide.</summary>SomeText</details>'
Text
## how to do the same using info stored in 'Text' object
```
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在代码块中使用
resulte ='asis'
:You can use
results='asis'
in the code chunk: