This file is indexed.

/usr/lib/R/site-library/knitr/examples/knitr-beamer.Rnw is in r-cran-knitr 1.17-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
%% LyX 2.2.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[10pt]{beamer}
\usepackage[T1]{fontenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{url}
\ifx\hypersetup\undefined
  \AtBeginDocument{%
    \hypersetup{unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=false}
  }
\else
  \hypersetup{unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=false}
\fi
\usepackage{breakurl}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{\texorpdfstring%
  {L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
  {LyX}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
 % this default might be overridden by plain title style
 \newcommand\makebeamertitle{\frame{\maketitle}}%
 % (ERT) argument for the TOC
 \AtBeginDocument{%
   \let\origtableofcontents=\tableofcontents
   \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
   \def\gobbletableofcontents#1{\origtableofcontents}
 }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usetheme{PaloAlto}

\makeatother

\begin{document}
<<setup, include=FALSE>>=
library(knitr)
opts_chunk$set(fig.path='figure/beamer-',fig.align='center',fig.show='hold',size='footnotesize')
@

\title[knitr, Beamer, and FragileFrame]{A Minimal Demo of knitr with Beamer and Fragile Frames}

\author{Yihui Xie\thanks{I thank Richard E. Goldberg for providing this demo.}}
\makebeamertitle
\begin{frame}{Background}

\begin{itemize}
\item The \textbf{knitr}\textbf{\emph{ }}package allows you to embed R code
and figures in \LaTeX{} documents

\begin{itemize}
\item It has functionality similar to Sweave but looks nicer and gives you
more control
\end{itemize}
\item If you already have Sweave working in \LyX{}, getting \textbf{knitr}
to work is trivial

\begin{enumerate}
\item Install the \textbf{knitr} package in \emph{R}
\item Read \url{https://yihui.name/knitr/demo/lyx/}
\end{enumerate}
\item If you use Sweave or \textbf{knitr} with Beamer in \LyX{}, you must
use the\emph{ FragileFrame} environment for the frames that contain
R code chunks. Let's see if \textbf{knitr} works with Beamer in this
small demo. 
\end{itemize}
\end{frame}

\section{First Test}
\begin{frame}[fragile]{First Test}

OK, let's get started with just some text:

<<echo=FALSE,results='hide'>>=
# some setup
options(width=60)  # make the printing fit on the page
set.seed(1121)   # make the results repeatable
@

<<>>= 
# create some random numbers
(x=rnorm(20))  
mean(x);var(x)  
@

BTW, the first element of \texttt{x} is \Sexpr{x[1]}. (Did you notice
the use of\texttt{ \textbackslash{}Sexpr\{\}}?)
\end{frame}

\section{Second Test}
\begin{frame}[fragile]{Second Test}

Text is nice but let's see what happens if we make a couple of plots
in our chunk:

<<boring-plots,fig.width=4,fig.height=4,out.width='.45\\linewidth'>>=
par(las=1,mar=c(4,4,.1,.1))  # tick labels direction
boxplot(x) 
hist(x,main='',col="blue",probability=TRUE) 
lines(density(x),col="red")
@
\end{frame}

\section{The Big Question}
\begin{frame}{The Big Question}

Do the above chunks work? You should be able to compile the \LyX{}
document and get a nice-looking PDF slide presentation. If not, time
to double-check everything...
\end{frame}

\end{document}