R Shiny中的空白

时间:2017-10-16 08:54:33

标签: r whitespace shinydashboard

我在Shiny Dashboard中遇到文本问题。我想保存原始文本格式,但闪亮删除了我想保留的空格。

program App1Learning;

var
  a, b : integer;

begin
  read(a);
  read(b);
  while a <> b do
  begin
    if a < b then b := b - a;
    if a > b then a := a - b;
  end;
  writeln(a);
  readln;
end.

不幸的是我得到output$frame <- renderUI({ HTML(paste( p(strong("Name and Surname:"),(" John Smith")) ) ) }) tabItem(tabName = "aaa", h2("bbb"), fluidRow( box(width = 6, solidHeader = TRUE, htmlOutput("frame")) ) ), 我希望"Name and Surname: John Smith".

如何解决这个问题?

3 个答案:

答案 0 :(得分:2)

我发现我们也可以使用包stri_dup(intToUtf8(160), 6)中的stringi

答案 1 :(得分:1)

您可以使用HTML('&nbsp;')添加1个空格和HTML('&emsp;')来添加1个标签空间。在您的代码中,它将如下所示:

output$frame <- renderUI({
        HTML(paste(
          p(strong("Name and Surname:"), HTML('&nbsp;'),HTML('&nbsp;'),"John Smith")
        )
        )
      })

有了这个你得到两个空格,输出如下: enter image description here

答案 2 :(得分:0)

我发现这很难实现。只是将样式元素添加到预包装中,就引入了额外的新行:

p(strong("Name and Surname:"),("     John Smith"),style="white-space: pre-wrap")

没有其他样式元素(margin:0等)可以解决此问题...因此,为了解决这个问题,我只是将您的strong()转换为HTML,并且效果很好:

p(HTML("<b>Name and Surname:</b>         John Smith"),style="white-space: pre-wrap")