I would like to change the color of one valuebox according by comparing the mean of a variable (here OverallYield) to a specific threshold (here = 80)
### Average Value (for selected options)
```{r}
renderValueBox({
valueBox(round(mean(selectedData()$OverallYield)),
if(round(mean(selectedData()$OverallYield)) >80){
color = "green"
} else {
color = "red"
})
})
With the code above, the word "green" or "red" appears depending on the threshold (80).
Any idea how i can link this to the valuebox color instead of words "green / red" ?
Note that: selectedData() is reactive.
@FJCC .. Thanks a lot for providing this example !
Based on it, I've re-written mycode and I managed to get it done right with my dataset.
However, I must admit I didn't fully understand how the renderValueBox works. I'll try to figure it out with the documentations.