R函数没有生成所需的输出

R function not generating desired output

box(853, title = "No of Employees", width = 2, height = "155px", status = "primary", solidHeader = TRUE, id = "empid")

生产

<div class="col-sm-2">
  <div class="box box-solid box-primary" style="height: 155px">
    <div class="box-header">
      <h3 class="box-title">No of Employees</h3>
    </div>
    <div class="box-body" id="empid">853</div>
  </div>
</div>

您可能会看到生成了 class = "box-title"

我想创建一个新函数,我想在其中修复宽度、高度、状态和 solidheader

所以我创建了一个,

vas_metric_box <- function(..., title, w = 2, h = "155px", id = NULL){
  box(..., title, solidHeader = TRUE, status = "primary", width = w, height = h, id = id)
}

产生

<div class="col-sm-2">
  <div class="box box-solid box-primary" style="height: 155px">
    <div class="box-body" id="empid">
      853
      No of Employees
    </div>
  </div>
</div>

问题

1) 如何在我的代码中生成框标题。 2) 我在我的函数中使用相同的代码,为什么两种方法之间存在差异?

vas_metric_box 中调用 box 时传递 title 的方式未被 box 正确解释。这样写:

vas_metric_box <- function(..., title, w = 2, h = "155px", id = NULL){
  box(..., title = title, solidHeader = TRUE, status = "primary", width = w, height = h, id = id)
}