R Lexer
R
R-block
6.3.90.900

R Lexer

Leif Andersen

 (require r-lexer) package: r-lexer

The R and R-block forms are used for typesetting R code.

syntax

(R str-expr ...+)

 
  str-expr : string?
Similar to the code function. Parses R code from strings into the inline text of the document.

For example,

This is @R{1 + 2}.

produces the typeset result:

This is 1 + 2.

str-expr is a list of strings representing R code.

syntax

(R-block str-expr ...+)

 
  str-expr : string?
Similar to the codeblock function. Parses R code from strings into a block in the document.

For example,

@R-block|{
  f <- function (x) {
    if (f <= 1) 1;
    else        x*f(x-1);
  }
}|

produces the typset result:

 f <- function (x) {
   if (f <= 1) 1;
   else        x * f(x - 1);
 }

str-expr is a list of strings representing R code.