Building on my question here: Include Sweave input as verbatim
Is there a way to include the term \Sexpr{
in the Sweave document as verbatim. For example, to write:
R code can be evaluated inline with the \Sexpr{} function:
Followed by an example of LaTeX code with the \Sexpr{} command in a verbatim environment.
My first guess was to write an R function that generates it:
sxpr <- function(x)
{
paste(paste("\\\\","Se","","xpr{",sep=""),x,"}",sep="")
}
So that I could write \Sexpr{sxpr('')}
, however, apparently Sweave runs many times and this does not work. My second guess was to make a seperate file with only \Sexpr{
in it and input it. This works, but not in a verbatim environment.
Is it possible?