title: Shiny Conditional infoBox Output
body: <p>I have a dashboard created with shinyDashboard that will display some operational information. We have 5 areas of our IT organization that we can declare "Touch" or "No Touch", depending on what is going on in the environment. </p>
  
  <p>I am using a simple REST API to get the data, which looks like (single column data frame):</p>
  
  <pre><code>Status
  eECC:Touch
  DOC:Touch
  CCC:Touch
  GEN:Touch
  IT:No Touch
  </code></pre>
  
  <p>That data frame gets written out to an .RData file and loaded using the reactiveFileReader(). Once it's there, I want to build some infoBox()es to display a banner across the top of the screen to show the environments and if they can have changes made in them or not. This is a clip of my ui.R code:</p>
  
  <pre><code> fluidRow(
      h4("Touch / No Touch", align="center"),
      infoBox("ECC", "TOUCH", icon = icon("ok", lib = "glyphicon"), width = 2, color = "green"),
      infoBox("DOC", "TOUCH", icon = icon("ok", lib = "glyphicon"), width = 2, color = "green"),
      infoBox("CCC", "TOUCH", icon = icon("ok", lib = "glyphicon"), width = 2, color = "green"),
      infoBox("GEN","TOUCH", icon = icon("ok", lib = "glyphicon"), width = 2, color = "green"),
      infoBox("IT", "NO TOUCH", icon = icon("alert", lib = "glyphicon"), width = 2, color = "red")
      ),
  </code></pre>
  
  <p>So, this is a static example, I know. It was originally put in place as a proof of concept. What I'd like to do is take the input I get from reading the data from the touchNoTouchDF.RData file and have the colors, Icons and text change based upon what's in the RData file. </p>
  
  <p>My first attempt was to use <code>if else</code> statements, but it doesn't appear that shiny likes that, or I did it wrong:</p>
  
  <pre><code>fluidRow(
  h4("Touch / No Touch", align="center"),
  if(touchNoTouchDF[1] == "ECC:Touch") {
  infoBox("ECC", "TOUCH", icon = icon("ok", lib = "glyphicon"), width = 2, color = "green")} else { infoBox("ECC", "TOUCH", icon = icon("ok", lib = "glyphicon"), width = 2, color = "green")},
  ...
  ...
  </code></pre>
  
  <p>That didn't seem to work, so my next idea was to "build" the string inside the infoBox() function in my dataframe and handle the logic in my R script. Therefore, my data frame (now 2 columns) would look like:</p>
  
  <pre><code>Status      UI
  ECC:Touch   "ECC", "TOUCH", icon = icon("ok", lib = "glyphicon"), width... 
  </code></pre>
  
  <p>Then, when building the UI, just simply doing the following:</p>
  
  <pre><code>fluidRow(
    h4("Touch / No Touch", align="center"),
    infoBox(touchNoTouchDF[1,2]),
    infoBox(touchNoTouchDF[2,2]),
    infoBox(touchNoTouchDF[3,2]),
    infoBox(touchNoTouchDF[4,2]),
    infoBox(touchNoTouchDF[5,2])
  ),
  </code></pre>
  
  <p>Well, that just prints the text on the infoBox (in all capital letters, too, seemed strange to me...). Anyway, I can't seem to figure out how to make these infoBox()es dynamic with what I am reading from the RData file. Any tips? Is there a certain function I have to use when calling the text into the infoBox() function other than just the dataframe and row/column? Thanks in advance!</p>