r - 使用库 rtf 将 R 表达式插入单词
问题描述
我想知道它是否可能将 R 表达式或 R 对象插入到一个单词中:
例子:
data(mtcars)
(table=head(mtcars,20))
addParagraph(doc, "\n\n Table cars \n")
addTable(doc, cbind(rownames(table), table))
nrow(mtcars)
In this table we can see that data contain nrow(mtcars) rows
但用我的话来说会显示:
"In this table we can see that data contain 32 rows"
在此先感谢 R
解决方案
最后我可以在一个词中插入一个对象。使用 rtf 和胶水包:
library(rtf)
library(glue)
data(mtcars)
total=nrow(mtcars)
addText(todo, glue("In this table we can see that data contain {nrow(mtcars)} rows"))
我的话显示:
"In this table we can see that data contain 32 rows"
推荐阅读
- android - 致命异常:java.lang.AssertionError - 升级 gradle 插件版本后
- wordpress - WordPress | 付款后设置订阅续订日期
- python-3.x - 如何解析所有
特定范围内的标签
标签? - if-statement - 如何通过 NGINX 中的标头值创建 proxy_pass 联结?
- node.js - Crypto Hmac 在 Node.js 中创建不同的哈希
- javascript - 添加带有函数参数的 EventListener
- python-3.x - Matplotlib 导入错误(预期的 str、bytes 或 os.PathLike 对象,而不是 PosixPath)
- javascript - VUE检测按键和重复按键检测错误
- php - Laravel 不会触发更新功能
- java - 在java中将int分配给字节