/usr/lib/R/site-library/brew/brew-test-1.brew is in r-cran-brew 1.0-6-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 | \documentclass[a4paper]{article}
\title{A \emph{brew} Test File}
\author{\emph{Jeffrey Horner}}
\usepackage{a4wide,graphicx}
\begin{document}
\maketitle
A simple example that will run in any \emph{R} engine \emph{(brew may work with S, but this is untested)}: The integers from 1 to
10 are
\begin{verbatim}
<%=format(1:10)%>
\end{verbatim}
We can also emulate a simple calculator \emph{(although the syntax is not as elegant as Sweave)}:
\begin{verbatim}
<% for (i in c('1+1','1+pi','1+pi','sin(pi/2)')) { -%>
> <%=i%>
<% print(eval(parse(text=i))) %>
<% } -%>
\end{verbatim}
Now we look at Gaussian data:
\begin{verbatim}
<%
library(stats)
x <- rnorm(20)
print(x)
print(t1 <- t.test(x))
%>
\end{verbatim}
Note that we can easily integrate some numbers into standard text: The
third element of vector \texttt{x} is <%=x[3]%>, the
$p$-value of the test is <%=format.pval(t1$p.value)%>. % $
Now we look at a summary of the famous iris data set, and we want to
see the commands in the code chunks \emph{(brew can't show you the code, so
don't look for it)}:
\begin{verbatim}
<%
library(datasets)
data(iris)
print(summary(iris))
%>
\end{verbatim}
<%
library(grDevices)
library(graphics)
postscript(file='brew-test-1-1.eps',
width=5,height=5,paper='special',horizontal=FALSE)
pairs(iris)
dev.off()
%>
\begin{figure}[htbp]
\begin{center}
\includegraphics{brew-test-1-1}
\caption{Pairs plot of the iris data.}
\end{center}
\end{figure}
<%
postscript(file='brew-test-1-2.eps',
width=5,height=5,paper='special',horizontal=FALSE)
boxplot(Sepal.Length~Species, data=iris)
dev.off()
%>
\begin{figure}[htbp]
\begin{center}
\includegraphics{brew-test-1-2}
\caption{Boxplot of sepal length grouped by species.}
\end{center}
\end{figure}
\end{document}
|