mercredi 21 septembre 2016

valuebox missing true/false statement

I am attempting to have two if else statements in a renderValuebox in shiny R. Here's the code:

  output$treenum <- renderValueBox({
    valueBox(
      paste0(nrow(grap), "Trees sampled out of ", sampReq, "required."),
      if(nrow(grap)>=sampReq){ 
        icon = icon("thumbs-up", lib = "glyphicon")}else
        {icon = icon("thumbs-down", lib = "glyphicon")},
      if(nrow(grap)>=sampReq){ color = "green"} else {colour = "red"}
    )
  })

I am receiving Warning: Error in if: missing value where TRUE/FALSE needed

However both if else is completed, maybe I am missing something.

Cheers,

Aucun commentaire:

Enregistrer un commentaire