首页 > 解决方案 > 在 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

标签: r

解决方案


推荐阅读