简体   繁体   English

在 R sapply() function 中使用内联 HTML

[英]Use inline HTML in R sapply() function

I am very noob in coding and R, so I am sorry if this is stupid.我在编码和 R 方面非常菜鸟,所以如果这很愚蠢,我很抱歉。

In shiny, I run multiple helpText on my sidebarPanel so I tried to use sapply to make less repetitions of the function.在 shiny 中,我在 sidebarPanel 上运行了多个helpText ,因此我尝试使用 sapply 来减少 function 的重复。 It works great, except for the texts where I use inline HTML (as the helpText function allows).它工作得很好,除了我使用内联 HTML 的文本(因为helpText function 允许)。

Do you know how I can still keep some formating in sapply ?你知道我怎么还能在sapply中保持一些格式吗? Here is the part of my code that i want to update:这是我要更新的代码部分:

# Help text
        helpText(h3("FAQ")),
        lapply(
          c(
            "text",
            "more text"
          ),
          helpText
        ),
        helpText(h3("Title")),
        lapply(
          c(
            "words",
            "palabras",
            "mots",
            "I love cats"
          ),
          helpText
        ),

Thank you谢谢

Well, I feel a bit stupid now...嗯,我现在觉得有点傻……

For posterity:为后代:

        lapply(
          c(
            lapply("FAQ", shiny::h3),
            "text",
            "more text",
            lapply("Title", shiny::h3),
            "words",
            "palabras,
            "mots",
            "I love cats"
          ),
          helpText
        )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM