forked from yihui/knitr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinline_expr.Rd
30 lines (29 loc) · 916 Bytes
/
inline_expr.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
% Please edit documentation in R/parser.R
\name{inline_expr}
\alias{inline_expr}
\title{Wrap code using the inline R expression syntax}
\usage{
inline_expr(code, syntax)
}
\arguments{
\item{code}{a character string of the inline R source code}
\item{syntax}{a character string to specify the syntax, e.g. \code{rnw},
\code{html}, or \code{md}, etc; if not specified, it will be guessed from
the knitting context}
}
\value{
A character string marked up using the inline R code syntax.
}
\description{
This is a convenience function to write the "source code" of inline R
expressions. For example, if you want to write \samp{`r 1+1`} literally in an
R Markdown document, you may write \samp{`` `r knitr::inline_expr('1+1')`
``}; for Rnw documents, this may be
\samp{\verb|\Sexpr{knitr::inline_expr{'1+1'}}|}.
}
\examples{
library(knitr)
inline_expr("1+1", "rnw")
inline_expr("1+1", "html")
inline_expr("1+1", "md")
}