I am trying to highlight some error in a file by changing the format (color or bold...) of a text according to a condition in a R markdown sheet. I checked at this topic Conditional font color R Markdown but as I am working in a "shiny" context it needs to be embedded in a renderText. So I tried different possibilities:
```{r}
output$text <- renderText({
if(length(test) > 0) {
div(paste("There is a value missing line(s):", paste(test[[1]], sep = " ", collapse = " ")), style = "color = red")
} else {
"There is no missing value"
}
})
```
r textOutput('text')`
I also tried:
output$text <- renderText({
if(length(test) > 0) {
paste("**There is a value missing line(s):", paste(test[[1]], sep = " ", collapse = " "), "**"))
} else {
"There is no missing value"
}
})
or that :
output$text <- renderText({
if(length(test) > 0) {
paste(eval(parse(text = "**")), "There is a value missing line(s):", paste(test[[1]], sep = " ", collapse = " "), eval(parse(text = "**")))
} else {
"There is no missing value"
}
})
and
output$text <- renderText({
if(length(test) > 0) {
text.Toprint <- paste("** There is a problem of number of values line(s):", paste(test[[1]], sep = " ", collapse = " "), "**")
HTML(text.Toprint)
} else {
"There is no missing value"
}
})
and finally:
output$text <- renderText({
if(length(test) > 0) {
text.Toprint <- paste("<b> There is a mistake column. Check the line:", paste(test[[1]], sep = " ", collapse = " "), "</b>")
HTML(text.Toprint)
} else {
"There is no missing value"
}
})
But none of them are working.
Do you have some idea or any documentation to advise ?
Thanks a lot and good evening :)
Cha