Reputation: 1457
I have a print statement in R
as a macro in Markdown
```{r chunk_name, echo=FALSE}
if ( any(so.results$Duration <0.0))
{print("there are non-positive durations")
} else
{print("all durations are fine!")}
```
and I want to generate a PDF, not an XML! How can I print "all durations are fine!"
in colour for example green or red?
Upvotes: 2
Views: 172
Reputation: 1457
Using HERE and HERE and the hints given by User I wrote the following:
```{r, results='asis', echo=FALSE}
if ( any(so.results$Duration <0.0))
{cat("\n") print("\textcolor{blue}
{print("there are non-positive durations}")
} else
{cat("\n") print("\textcolor{red}{print("all durations are fine!}")}
```
which solves the problem.
Upvotes: 1