title: If else loop in r markdown
body: <p>Hi Have a data frame generated from a calculation. This dataframe will have results from other calculations and finally it will have something like this.</p>
  
  <p>Minimum working code</p>
  
  <pre><code>```{r echo = FALSE, message=FALSE, } 
          cond_a &lt;- c(1,2,3,4)
          cond_b &lt;- c("a","v","b","c")
          reminder &lt;- c(3,4,6,7)
          Diff &lt;- c(0,1,0,0)
          df = data.frame(cond_a, cond_b, reminder, Diff)       # df is a data frame
          df$Result &lt;- ifelse(df$Diff !=0, "FAIL", "PASS")
          Test_Results &lt;- subset(df, Diff != 0)
  
  ```
  </code></pre>
  
  <p>After the dataframe is generated, I am putting this whole thing in a R markdown document and want to print it in a way that if the dataframe has 0 rows, then I want to Print- "Test case passed", if dataframe has some rows(i.e failed records), then I want to print the dataframe.</p>
  
  <pre><code>```{r echo = FALSE, message=FALSE, }
      if {nrow(Test_Results) = 0
      print("Test case Passed")}
      else {
       DT::datatable(Test_Results)  
      }
  ```
  </code></pre>
  
  <p>So far, I am not able to produce expected results. any help please. </p>