File: inline_expr.Rd

package info (click to toggle)
r-cran-knitr 1.50%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,864 kB
  • sloc: makefile: 16; sh: 10; javascript: 8
file content (31 lines) | stat: -rw-r--r-- 958 bytes parent folder | download | duplicates (4)
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
31
% Generated by roxygen2: do not edit by hand
% 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}{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}. If not specified, this 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")
}