Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Basic R guide: verbatim ? with knitr in R

I'm producing an introductory R guide for my company. I'm doing a little demo of the R help function (shorthand)

?mean

This is in a knitr chunk:

<<eval=FALSE>>=
?mean
@

Output:

`?`(mean)

I would prefer that it outputs it as I type it, i.e. ?mean not ?(mean) (with backticks). Does anyone know of a workaround for this?

Thanks!

Apologies if this is a repeat question or has a very simple solution - it's not an easy topic to search for!

like image 403
dynamo Avatar asked Feb 04 '13 13:02

dynamo


1 Answers

Setting tidy=FALSE will give you the result you're looking for:

<<eval=FALSE, tidy=FALSE>>=
?mean
@

Output

?mean
like image 69
Josh O'Brien Avatar answered Sep 28 '22 17:09

Josh O'Brien