| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/parser.R |
| 3 |
\name{inline_expr} |
| 4 |
\alias{inline_expr} |
| 5 |
\title{Wrap code using the inline R expression syntax} |
| 6 |
\usage{ |
| 7 |
inline_expr(code, syntax) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{code}{Character string of the inline R source code.} |
| 11 |
|
| 12 |
\item{syntax}{A character string to specify the syntax, e.g. \code{rnw}, |
| 13 |
\code{html}, or \code{md}. If not specified, this will be guessed from |
| 14 |
the knitting context.} |
| 15 |
} |
| 16 |
\value{ |
| 17 |
A character string marked up using the inline R code syntax. |
| 18 |
} |
| 19 |
\description{ |
| 20 |
This is a convenience function to write the "source code" of inline R |
| 21 |
expressions. For example, if you want to write \samp{`r 1+1`} literally in an |
| 22 |
R Markdown document, you may write \samp{`` `r knitr::inline_expr('1+1')` |
| 23 |
``}; for Rnw documents, this may be |
| 24 |
\samp{\verb|\Sexpr{knitr::inline_expr{'1+1'}}|}. |
| 25 |
} |
| 26 |
\examples{ |
| 27 |
library(knitr) |
| 28 |
inline_expr("1+1", "rnw") |
| 29 |
inline_expr("1+1", "html") |
| 30 |
inline_expr("1+1", "md") |
| 31 |
} |