| 1 |
\documentclass[a4paper]{article} |
| 2 |
|
| 3 |
\title{A \emph{brew} Test File} |
| 4 |
\author{\emph{Jeffrey Horner}} |
| 5 |
|
| 6 |
\usepackage{a4wide,graphicx} |
| 7 |
|
| 8 |
\begin{document} |
| 9 |
|
| 10 |
\maketitle |
| 11 |
|
| 12 |
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 |
| 13 |
10 are |
| 14 |
\begin{verbatim} |
| 15 |
1 2 3 4 5 6 7 8 9 10 |
| 16 |
\end{verbatim} |
| 17 |
|
| 18 |
We can also emulate a simple calculator \emph{(although the syntax is not as elegant as Sweave)}: |
| 19 |
\begin{verbatim} |
| 20 |
> 1+1 |
| 21 |
[1] 2 |
| 22 |
|
| 23 |
> 1+pi |
| 24 |
[1] 4.141593 |
| 25 |
|
| 26 |
> 1+pi |
| 27 |
[1] 4.141593 |
| 28 |
|
| 29 |
> sin(pi/2) |
| 30 |
[1] 1 |
| 31 |
|
| 32 |
\end{verbatim} |
| 33 |
|
| 34 |
Now we look at Gaussian data: |
| 35 |
|
| 36 |
\begin{verbatim} |
| 37 |
[1] 1.37095845 -0.56469817 0.36312841 0.63286260 0.40426832 -0.10612452 |
| 38 |
[7] 1.51152200 -0.09465904 2.01842371 -0.06271410 1.30486965 2.28664539 |
| 39 |
[13] -1.38886070 -0.27878877 -0.13332134 0.63595040 -0.28425292 -2.65645542 |
| 40 |
[19] -2.44046693 1.32011335 |
| 41 |
|
| 42 |
One Sample t-test |
| 43 |
|
| 44 |
data: x |
| 45 |
t = 0.65387, df = 19, p-value = 0.521 |
| 46 |
alternative hypothesis: true mean is not equal to 0 |
| 47 |
95 percent confidence interval: |
| 48 |
-0.422409 0.806249 |
| 49 |
sample estimates: |
| 50 |
mean of x |
| 51 |
0.19192 |
| 52 |
|
| 53 |
|
| 54 |
\end{verbatim} |
| 55 |
|
| 56 |
Note that we can easily integrate some numbers into standard text: The |
| 57 |
third element of vector \texttt{x} is 0.3631284, the |
| 58 |
$p$-value of the test is 0.52103. % $ |
| 59 |
|
| 60 |
Now we look at a summary of the famous iris data set, and we want to |
| 61 |
see the commands in the code chunks \emph{(brew can't show you the code, so |
| 62 |
don't look for it)}: |
| 63 |
|
| 64 |
\begin{verbatim} |
| 65 |
Sepal.Length Sepal.Width Petal.Length Petal.Width |
| 66 |
Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100 |
| 67 |
1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300 |
| 68 |
Median :5.800 Median :3.000 Median :4.350 Median :1.300 |
| 69 |
Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199 |
| 70 |
3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800 |
| 71 |
Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500 |
| 72 |
Species |
| 73 |
setosa :50 |
| 74 |
versicolor:50 |
| 75 |
virginica :50 |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
\end{verbatim} |
| 81 |
|
| 82 |
|
| 83 |
\begin{figure}[htbp] |
| 84 |
\begin{center} |
| 85 |
\includegraphics{brew-test-1-1} |
| 86 |
\caption{Pairs plot of the iris data.} |
| 87 |
\end{center} |
| 88 |
\end{figure} |
| 89 |
|
| 90 |
|
| 91 |
\begin{figure}[htbp] |
| 92 |
\begin{center} |
| 93 |
\includegraphics{brew-test-1-2} |
| 94 |
\caption{Boxplot of sepal length grouped by species.} |
| 95 |
\end{center} |
| 96 |
\end{figure} |
| 97 |
|
| 98 |
\end{document} |
| 99 |
|
| 100 |
|