1

I am building a report in R with the use of knitr. The file is of .Rnw extension and I compile it into PDF file.

I faced a problem when using a woe::iv.mult function. Using this function causes some information being printed on the console and the same information is then contained within the resulted PDF file (see the example below). Q: How can I avoid this unwanted function output being included in the output file?

(I believe it is more general issue than only with the woe::iv.mult function; I have faced similar problem when working with some time series methods, unfortunately I do not remember the details.)

test.Rnw

\documentclass{article}
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}

\begin{document}
<<setup, echo=FALSE, cache=FALSE>>=
library(knitr)
knitr::opts_chunk$set(echo=F, eval=T, message = F, warning=F, cache = TRUE, fig=TRUE)
@

I do not want this to be printed in PDF output: 
<<chunk1, echo=FALSE, message=FALSE>>=
library(woe)
iv.mult.res <- iv.mult(german_data,"gb", verbose = FALSE)
@

And I want this to be printed in PDF output: 
<<chunk2>>=
print(iv.mult.res[[1]])
@
\end{document}

output screenshot

enter image description here

Marta Karas
  • 4,967
  • 10
  • 47
  • 77

1 Answers1

1

My guess is that the package author used cat() instead of message() to write out the messages, in which case you will have to use results = 'hide' to hide the text output (more info here).

Yihui Xie
  • 28,913
  • 23
  • 193
  • 419