r - 在 R 中加入 html 标签
问题描述
我正在尝试将 html 标签与以下代码合并到 R 数据框中,但出现如下错误。我需要 Id 作为颜色,所以粘贴它,但看起来这里有一些问题
> asd <- data.frame(color = c("red", "black"), text = c("Something1", "Something2"))
> asd
color text
1 red Something1
2 black Something2
> asd$html <- paste0(tags$div(id = asd$color))
Error in writeImpl(text) :
Text to be written must be a length-one character vector
In addition: Warning message:
In if (!is.na(attribValue)) { :
the condition has length > 1 and only the first element will be used
解决方案
推荐阅读
- python - 在 pandas DataFrame 中将多列转置为 1 列
- regex - 使用 regex + index 搜索不以特定前缀开头的字符串
- c# - 获取与特定字符串模式匹配的项目列表
- sql - 如何确定修改后源表和目标表的记录数是否相同?如何同步?
- reactjs - 为什么不使用自定义箭头以及如何呈现数字当前幻灯片?
- android - 应用程序被杀死并重新启动后,React Native Callback 保留引用
- python - 带有循环和条件语句的 Python 脚本
- javascript - 套接字客户端未连接
- excel - 不要在空单元格上运行的公式中显示#N/A
- python - 将 3 个数据框列合并为 1 个优先级,同时避免应用