I have a variable assigned as a output of a function, which returns numeric value or NA. The following code mimics it.

data <- sample(c(TRUE, FALSE), size = 1, replace = TRUE)

Somewhere in the TeX (knitr), i need to print whether the output is VALID or NA. I try to do it like this


but my text output is blank. Note that I don't need to print the numeral value, just VALID / NA. Any hints?

  • 2
    This question was posted somewhere else (or maybe here but a different question), but I forget where. Can you please link to your other question?
    – scottkosty
    Commented Aug 19, 2015 at 5:34
  • Thanks scottkosty. I had asked a similar question earlier. tex.stackexchange.com/questions/260994. Not quite the same.
    – tallharish
    Commented Aug 19, 2015 at 14:53
  • Still looking for an answer :|
    – tallharish
    Commented Aug 25, 2015 at 18:00
  • For me the output has TRUE where the Sexpr is. Can you please post a minimal .Rnw example?
    – scottkosty
    Commented Aug 26, 2015 at 12:44


You must log in to answer this question.

Browse other questions tagged .