R: tr(),th()和thead() - 它们属于哪个包?

4
我使用自定义容器构建了一个类似于这里(2.6 - 2.6 自定义表格容器)的DT表格。 我正在打包使用此表格的shiny应用程序,并希望找出用于定义sketch对象的th()tr()thead()函数所属的软件包。 ??thead等命令指向各种DT函数,但是?DT::thead()没有返回文档。 谢谢任何指针!

1
这些是 htmltools 包中 tags 的一些字段:tags$theadtags$th。您可以通过 withTags(......) 访问这些标签,就像您提供的链接中所示。 - Stéphane Laurent
1个回答

3
您应该注意,在sketch的定义中,他们调用了htmltools::withTags,这是非常简单的。
function (code) 
{
    eval(substitute(code), envir = as.list(tags), enclos = parent.frame())
}
<bytecode: 0x000001c832d09200>
<environment: namespace:htmltools>

需要注意的是,这将使用substituteenvir = as.list(tags)。如果我们查看 tags ,它是一个带有以下命名对象/函数的列表:

> names(tags)
  [1] "a"           "abbr"        "address"     "area"        "article"     "aside"       "audio"      
  [8] "b"           "base"        "bdi"         "bdo"         "blockquote"  "body"        "br"         
 [15] "button"      "canvas"      "caption"     "cite"        "code"        "col"         "colgroup"   
 [22] "command"     "data"        "datalist"    "dd"          "del"         "details"     "dfn"        
 [29] "div"         "dl"          "dt"          "em"          "embed"       "eventsource" "fieldset"   
 [36] "figcaption"  "figure"      "footer"      "form"        "h1"          "h2"          "h3"         
 [43] "h4"          "h5"          "h6"          "head"        "header"      "hgroup"      "hr"         
 [50] "html"        "i"           "iframe"      "img"         "input"       "ins"         "kbd"        
 [57] "keygen"      "label"       "legend"      "li"          "link"        "mark"        "map"        
 [64] "menu"        "meta"        "meter"       "nav"         "noscript"    "object"      "ol"         
 [71] "optgroup"    "option"      "output"      "p"           "param"       "pre"         "progress"   
 [78] "q"           "ruby"        "rp"          "rt"          "s"           "samp"        "script"     
 [85] "section"     "select"      "small"       "source"      "span"        "strong"      "style"      
 [92] "sub"         "summary"     "sup"         "table"       "tbody"       "td"          "textarea"   
 [99] "tfoot"       "th"          "thead"       "time"        "title"       "tr"          "track"      
[106] "u"           "ul"          "var"         "video"       "wbr"   

每一个都基本上有相同的形式:
> tags$thead
function (...) 
tag("thead", list(...))
<bytecode: 0x000001c82c4a2678>
<environment: namespace:htmltools>

因此,它基本上只是一种方便的方法,以指定的标记调用tag函数。直接调用它的示例:

> tag("thead", "This is my thead")
<thead>This is my thead</thead>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接