% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math}
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
  pdftitle={On line collaboration},
  pdfauthor={Itec/MODR 2915},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage[margin=1in]{geometry}
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{#1}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.77,0.63,0.00}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{#1}}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{#1}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\usepackage{longtable,booktabs}
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering

\title{On line collaboration}
\author{Itec/MODR 2915}
\date{11/13/2018}

\begin{document}
\maketitle

This post examines the features of
\href{http://www.rstudio.org/docs/authoring/using_markdown}{R Markdown}
using \href{http://yihui.name/knitr/}{knitr} in Rstudio 0.96. This
combination of tools provides an exciting improvement in usability for
\href{http://stats.stackexchange.com/a/15006/183}{reproducible
analysis}. Specifically, this post (1) discusses getting started with R
Markdown and \texttt{knitr} in Rstudio 0.96; (2) provides a basic
example of producing console output and plots using R Markdown; (3)
highlights several code chunk options such as caching and controlling
how input and output is displayed; (4) demonstrates use of standard
Markdown notation as well as the extended features of formulas and
tables; and (5) discusses the implications of R Markdown. This post was
produced with R Markdown. The source code is available here as a gist.
The post may be most useful if the source code and displayed post are
viewed side by side. In some instances, I include a copy of the R
Markdown in the displayed HTML, but most of the time I assume you are
reading the source and post side by side.

\hypertarget{getting-started}{%
\subsection{Getting started}\label{getting-started}}

To work with R Markdown, if necessary:

\begin{itemize}
\tightlist
\item
  Install \href{http://www.r-project.org/}{R}
\item
  Install the lastest version of
  \href{http://rstudio.org/download/}{RStudio} (at time of posting, this
  is 0.96)
\item
  Install the latest version of the \texttt{knitr} package:
  \texttt{install.packages("knitr")}
\end{itemize}

To run the basic working example that produced this blog post:

\begin{itemize}
\tightlist
\item
  Open R Studio, and go to File - New - R Markdown
\item
  If necessary install \texttt{ggplot2} and \texttt{lattice} packages:
  \texttt{install.packages("ggplot2");\ install.packages("lattice")}
\item
  Paste in the contents of this gist (which contains the R Markdown file
  used to produce this post) and save the file with an \texttt{.rmd}
  extension
\item
  Click Knit HTML
\end{itemize}

\hypertarget{prepare-for-analyses}{%
\subsection{Prepare for analyses}\label{prepare-for-analyses}}

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{set.seed}\NormalTok{(}\DecValTok{1234}\NormalTok{)}
\KeywordTok{library}\NormalTok{(ggplot2)}
\KeywordTok{library}\NormalTok{(lattice)}
\end{Highlighting}
\end{Shaded}

\hypertarget{basic-console-output}{%
\subsection{Basic console output}\label{basic-console-output}}

To insert an R code chunk, you can type it manually or just press
\texttt{Chunks\ -\ Insert\ chunks} or use the shortcut key. This will
produce the following code chunk:

Pressing tab when inside the braces will bring up code chunk options.

The following R code chunk labelled \texttt{basicconsole} is as follows:

\begin{verbatim}
```r
x <- 1:10
y <- round(rnorm(10, x, 1), 2)
df <- data.frame(x, y)
df
```

```
##     x     y
## 1   1 -0.21
## 2   2  2.28
## 3   3  4.08
## 4   4  1.65
## 5   5  5.43
## 6   6  6.51
## 7   7  6.43
## 8   8  7.45
## 9   9  8.44
## 10 10  9.11
```
\end{verbatim}

The code chunk input and output is then displayed as follows:

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{x <-}\StringTok{ }\DecValTok{1}\OperatorTok{:}\DecValTok{10}
\NormalTok{y <-}\StringTok{ }\KeywordTok{round}\NormalTok{(}\KeywordTok{rnorm}\NormalTok{(}\DecValTok{10}\NormalTok{, x, }\DecValTok{1}\NormalTok{), }\DecValTok{2}\NormalTok{)}
\NormalTok{df <-}\StringTok{ }\KeywordTok{data.frame}\NormalTok{(x, y)}
\NormalTok{df}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
##     x     y
## 1   1  0.52
## 2   2  1.00
## 3   3  2.22
## 4   4  4.06
## 5   5  5.96
## 6   6  5.89
## 7   7  6.49
## 8   8  7.09
## 9   9  8.16
## 10 10 12.42
\end{verbatim}

\hypertarget{plots}{%
\subsection{Plots}\label{plots}}

Images generated by \texttt{knitr} are saved in a figures folder.
However, they also appear to be represented in the HTML output using a
\href{http://en.wikipedia.org/wiki/Data_URI_scheme}{data URI scheme}.
This means that you can paste the HTML into a blog post or discussion
forum and you don't have to worry about finding a place to store the
images; they're embedded in the HTML.

\hypertarget{simple-plot}{%
\subsubsection{Simple plot}\label{simple-plot}}

Here is a basic plot using base graphics:

\begin{verbatim}
```r
plot(x)
```

![](example-r-markdown_files/figure-latex/unnamed-chunk-4-1.pdf)<!-- --> 
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{plot}\NormalTok{(x)}
\end{Highlighting}
\end{Shaded}

\includegraphics{example-r-markdown_files/figure-latex/simpleplot-1.pdf}

Note that unlike traditional Sweave, there is no need to write
\texttt{fig=TRUE}.

\hypertarget{multiple-plots}{%
\subsubsection{Multiple plots}\label{multiple-plots}}

Also, unlike traditional Sweave, you can include multiple plots in one
code chunk:

\begin{verbatim}
```r
boxplot(1:10~rep(1:2,5))
```

![](example-r-markdown_files/figure-latex/unnamed-chunk-5-1.pdf)<!-- --> 

```r
plot(x, y)
```

![](example-r-markdown_files/figure-latex/unnamed-chunk-5-2.pdf)<!-- --> 
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{boxplot}\NormalTok{(}\DecValTok{1}\OperatorTok{:}\DecValTok{10}\OperatorTok{~}\KeywordTok{rep}\NormalTok{(}\DecValTok{1}\OperatorTok{:}\DecValTok{2}\NormalTok{,}\DecValTok{5}\NormalTok{))}
\end{Highlighting}
\end{Shaded}

\includegraphics{example-r-markdown_files/figure-latex/multipleplots-1.pdf}

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{plot}\NormalTok{(x, y)}
\end{Highlighting}
\end{Shaded}

\includegraphics{example-r-markdown_files/figure-latex/multipleplots-2.pdf}

\hypertarget{ggplot2-plot}{%
\subsubsection{\texorpdfstring{\texttt{ggplot2}
plot}{ggplot2 plot}}\label{ggplot2-plot}}

Ggplot2 plots work well:

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{qplot}\NormalTok{(x, y, }\DataTypeTok{data=}\NormalTok{df)}
\end{Highlighting}
\end{Shaded}

\includegraphics{example-r-markdown_files/figure-latex/ggplot2ex-1.pdf}

\hypertarget{lattice-plot}{%
\subsubsection{\texorpdfstring{\texttt{lattice}
plot}{lattice plot}}\label{lattice-plot}}

As do lattice plots:

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{xyplot}\NormalTok{(y}\OperatorTok{~}\NormalTok{x)}
\end{Highlighting}
\end{Shaded}

\includegraphics{example-r-markdown_files/figure-latex/latticeex-1.pdf}

Note that unlike traditional Sweave, there is no need to print lattice
plots directly.

\hypertarget{r-code-chunk-features}{%
\subsection{R Code chunk features}\label{r-code-chunk-features}}

\hypertarget{create-markdown-code-from-r}{%
\subsubsection{Create Markdown code from
R}\label{create-markdown-code-from-r}}

The following code hides the command input (i.e., \texttt{echo=FALSE}),
and outputs the content directly as code (i.e., \texttt{results=asis},
which is similar to \texttt{results=tex} in Sweave).

\begin{verbatim}
Here are some dot points

* The value of y[1] is 0.52
* The value of y[2] is 1
* The value of y[3] is 2.22
\end{verbatim}

Here are some dot points

\begin{itemize}
\tightlist
\item
  The value of y{[}1{]} is 0.52
\item
  The value of y{[}2{]} is 1
\item
  The value of y{[}3{]} is 2.22
\end{itemize}

\hypertarget{create-markdown-table-code-from-r}{%
\subsubsection{Create Markdown table code from
R}\label{create-markdown-table-code-from-r}}

\begin{verbatim}
x | y
--- | ---
1 | 0.52
2 | 1
3 | 2.22
4 | 4.06
5 | 5.96
6 | 5.89
7 | 6.49
8 | 7.09
9 | 8.16
10 | 12.42
\end{verbatim}

\begin{longtable}[]{@{}ll@{}}
\toprule
x & y\tabularnewline
\midrule
\endhead
1 & 0.52\tabularnewline
2 & 1\tabularnewline
3 & 2.22\tabularnewline
4 & 4.06\tabularnewline
5 & 5.96\tabularnewline
6 & 5.89\tabularnewline
7 & 6.49\tabularnewline
8 & 7.09\tabularnewline
9 & 8.16\tabularnewline
10 & 12.42\tabularnewline
\bottomrule
\end{longtable}

\hypertarget{control-output-display}{%
\subsubsection{Control output display}\label{control-output-display}}

The folllowing code supresses display of R input commands (i.e.,
\texttt{echo=FALSE}) and removes any preceding text from console output
(\texttt{comment=""}; the default is \texttt{comment="\#\#"}).

\begin{verbatim}
```
  x    y
1 1 0.52
2 2 1.00
3 3 2.22
4 4 4.06
5 5 5.96
6 6 5.89
```
\end{verbatim}

\begin{verbatim}
  x    y
1 1 0.52
2 2 1.00
3 3 2.22
4 4 4.06
5 5 5.96
6 6 5.89
\end{verbatim}

\hypertarget{control-figure-size}{%
\subsubsection{Control figure size}\label{control-figure-size}}

The following is an example of a smaller figure using \texttt{fig.width}
and \texttt{fig.height} options.

\begin{verbatim}
```r
plot(x)
```

![](example-r-markdown_files/figure-latex/unnamed-chunk-10-1.pdf)<!-- --> 
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{plot}\NormalTok{(x)}
\end{Highlighting}
\end{Shaded}

\includegraphics{example-r-markdown_files/figure-latex/smallplot-1.pdf}

\hypertarget{cache-analysis}{%
\subsubsection{Cache analysis}\label{cache-analysis}}

Caching analyses is straightforward. Here's example code. On the first
run on my computer, this took about 10 seconds. On subsequent runs, this
code was not run.

If you want to rerun cached code chunks, just
\href{http://stackoverflow.com/a/10629121/180892}{delete the contents of
the \texttt{cache} folder}

\begin{verbatim}
```r
for (i in 1:5000) {
    lm((i+1)~i)
}
```
\end{verbatim}

\hypertarget{basic-markdown-functionality}{%
\subsection{Basic markdown
functionality}\label{basic-markdown-functionality}}

For those not familiar with standard
\href{http://daringfireball.net/projects/markdown/}{Markdown}, the
following may be useful. See the source code for how to produce such
points. However, RStudio does include a Markdown quick reference button
that adequatly covers this material.

\hypertarget{dot-points}{%
\subsubsection{Dot Points}\label{dot-points}}

Simple dot points:

\begin{itemize}
\tightlist
\item
  Point 1
\item
  Point 2
\item
  Point 3
\end{itemize}

and numeric dot points:

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
  Number 1
\item
  Number 2
\item
  Number 3
\end{enumerate}

and nested dot points:

\begin{itemize}
\tightlist
\item
  A

  \begin{itemize}
  \tightlist
  \item
    A.1
  \item
    A.2
  \end{itemize}
\item
  B

  \begin{itemize}
  \tightlist
  \item
    B.1
  \item
    B.2
  \end{itemize}
\end{itemize}

\hypertarget{equations}{%
\subsubsection{Equations}\label{equations}}

Equations are included by using LaTeX notation and including them either
between single dollar signs (inline equations) or double dollar signs
(displayed equations). If you hang around the Q\&A site
\href{http://stats.stackexchange.com}{CrossValidated} you'll be familiar
with this idea.

There are inline equations such as \(y_i = \alpha + \beta x_i + e_i\).

And displayed formulas:

\[\frac{1}{1+\exp(-x)}\]

knitr provides self-contained HTML code that calls a Mathjax script to
display formulas. However, in order to include the script in my blog
posts I \href{https://gist.github.com/2716053}{took the script} and
incorporated it into my blogger template. If you are viewing this post
through syndication or an RSS reader, this may not work. You may need to
view this post on my website.

\hypertarget{tables}{%
\subsubsection{Tables}\label{tables}}

Tables can be included using the following notation

\begin{longtable}[]{@{}lll@{}}
\toprule
A & B & C\tabularnewline
\midrule
\endhead
1 & Male & Blue\tabularnewline
2 & Female & Pink\tabularnewline
\bottomrule
\end{longtable}

\hypertarget{hyperlinks}{%
\subsubsection{Hyperlinks}\label{hyperlinks}}

\begin{itemize}
\tightlist
\item
  If you like this post, you may wish to subscribe to
  \href{http://feeds.feedburner.com/jeromyanglim}{my RSS feed}.
\end{itemize}

\hypertarget{images}{%
\subsubsection{Images}\label{images}}

Here's an example image:

\begin{figure}
\centering
\includegraphics{http://i.imgur.com/RVNmr.jpg}
\caption{image from redmond barry building unimelb}
\end{figure}

\hypertarget{code}{%
\subsubsection{Code}\label{code}}

Here is Markdown R code chunk displayed as code:

\begin{verbatim}
```r
x <- 1:10
x
```

```
##  [1]  1  2  3  4  5  6  7  8  9 10
```
\end{verbatim}

And then there's inline code such as \texttt{x\ \textless{}-\ 1:10}.

\hypertarget{quote}{%
\subsubsection{Quote}\label{quote}}

Let's quote some stuff:

\begin{quote}
To be, or not to be, that is the question: Whether 'tis nobler in the
mind to suffer The slings and arrows of outrageous fortune,
\end{quote}

\hypertarget{conclusion}{%
\subsection{Conclusion}\label{conclusion}}

\begin{itemize}
\tightlist
\item
  R Markdown is awesome.

  \begin{itemize}
  \tightlist
  \item
    The ratio of markup to content is excellent.
  \item
    For exploratory analyses, blog posts, and the like R Markdown will
    be a powerful productivity booster.
  \item
    For journal articles, LaTeX will presumably still be required.
  \end{itemize}
\item
  The RStudio team have made the whole process very user friendly.

  \begin{itemize}
  \tightlist
  \item
    RStudio provides useful shortcut keys for compiling to HTML, and
    running code chunks. These shortcut keys are presented in a clear
    way.
  \item
    The incorporated extensions to Markdown, particularly formula and
    table support, are particularly useful.
  \item
    Jump-to-chunk feature facilitates navigation. It helps if your code
    chunks have informative names.
  \item
    Code completion on R code chunk options is really helpful. See also
    \href{http://yihui.name/knitr/options}{chunk options documentation
    on the knitr website}.
  \end{itemize}
\item
  Other recent posts on R markdown include those by :

  \begin{itemize}
  \tightlist
  \item
    \href{http://christophergandrud.blogspot.com.au/2012/05/dynamic-content-with-rstudio-markdown.html}{Christopher
    Gandrud}
  \item
    \href{http://lamages.blogspot.com.au/2012/05/interactive-reports-in-r-with-knitr-and.html}{Markcus
    Gesmann}
  \item
    \href{http://rstudio.org/docs/authoring/using_markdown}{Rstudio on R
    Markdown}
  \item
    \href{http://yihui.name/knitr/}{Yihui Xie}: I really want to thank
    him for developing \texttt{knitr}. He has also posted
    \href{https://github.com/yihui/knitr/blob/master/inst/examples/knitr-minimal.Rmd}{this
    example of R Markdown}.
  \end{itemize}
\end{itemize}

\hypertarget{questions}{%
\subsection{Questions}\label{questions}}

The following are a few questions I encountered along the way that might
interest others. \#\#\# Annoying \texttt{\textless{}br/\textgreater{}}'s
\textbf{Question:} I asked on the Rstudio discussion site:
\href{http://support.rstudio.org/help/discussions/problems/2329-why-does-r-markdown-to-html-insert-br-when-there-is-a-new-line-of-text}{Why
does Markdown to HTML insert \texttt{\textless{}br/\textgreater{}} on
new lines?}

\textbf{Answer:} I just do a find and delete on this text for now.

\hypertarget{temporarily-disable-caching}{%
\subsubsection{Temporarily disable
caching}\label{temporarily-disable-caching}}

\textbf{Question:} I asked on StackOverflow about
\href{http://stackoverflow.com/q/10628665/180892}{How to set cache=FALSE
for a knitr markdown document and override code chunk settings?}

\textbf{Answer:} Delete the cache folder. But there are other possible
workflows.

\hypertarget{equivalent-of-sexpr}{%
\subsubsection{Equivalent of Sexpr}\label{equivalent-of-sexpr}}

\textbf{Question:} I asked on Stack Overvlow about
\href{http://stackoverflow.com/q/10629416/180892}{whether there an R
Markdown equivalent to Sexpr in Sweave?}.

\textbf{Answer:} Include the code between brackets of ``backick r
space'' and ``backtick''. E.g., in the source code I have calculated 2 +
2 = 4 .

\end{document}
