I'm creating a table using renderTable but the HTML inside the table is not rendering:
This is the code snipit of interest:
if (is.null(Compare_Count) || is.na(Compare_Count) || length(Compare_Count) == 0L ) {
CT_Table[i, 3] <- HTML("<i class='icon-arrow-up'></i>")
} else if (CT_Table[i, 2] > Compare_Count) {
CT_Table[i, 3] <- print(tags$i(class='icon-arrow-up', style="text-color: green"), quote = FALSE)
}
Neither HTML
, paste
, or c
work.
How can I get the arrows to show?
Thanks!
server.r
: [Note, this is an example. The code is not complete, brackets may be mismatched, etc. Not important to the question.]
output$example <- renderTable(include.rownames=FALSE,{
CT_Table <- count(Canidates,vars=c("Name"))
CT_Table <- CT_Table[order(CT_Table["Recent Reviews: "], decreasing=T),]
for (i in 1:nrow(CT_Table)) {
Compare_Name <- paste(CT_Table$Product[i])
Compare_Count <- Can_trend[Can_trend$Name == Compare_Name, 2]
if (is.null(Compare_Count) || is.na(Compare_Count) || length(Compare_Count) == 0L )
{
CT_Table[i, 3] <- HTML("<i class='icon-arrow-up'></i>")
} else if (CT_Table[i, 2] > Compare_Count) {
CT_Table[i, 3] <- tags$i(class='icon-arrow-up', style="text-color: green")
} else if (CT_Table[i, 2] < Compare_Count) {
CT_Table[i, 3] <- tags$i(class='icon-arrow-down', style="text-color: red")
} else if (CT_Table[i, 2] == Compare_Count) {
CT_Table[i, 3] <- tags$i(class='icon-minus', style="text-color: yellow")
}
}
}
CT_Table
})
ui.r
is just a simple call to tableOutput
or htmlOutput
, but neither renders the html pasted into the column.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…