David Z
David Z

Reputation: 7041

knitr failed to print out system2() output

In R console, I can see the output from system2() by:

> STAR<-'/opt/NGS/STAR/STAR-2.5.2b/bin/Linux_x86_64_static/STAR'
>     system2(STAR,'--version')
STAR_2.5.2b

But when I have a chunk in a .Rnw file such like that:

\begin{frame}[fragile]{Global STAR settings}
<<echo=TRUE, results="asis">>=
STAR<-'/opt/NGS/STAR/STAR-2.5.2b/bin/Linux_x86_64_static/STAR'
system2(STAR,'--version')
@   
\end{frame}

It's supposed to print out STAR_2.5.2b on the page but nothing was printed. Does anybody know why?

Upvotes: 0

Views: 31

Answers (1)

Weihuang Wong
Weihuang Wong

Reputation: 13118

Try setting stdout = TRUE i.e. system2(STAR,'--version', stdout = TRUE).

Upvotes: 1

Related Questions