I am just starting with Sweave
and with R
. Here I am using R
to output some data and I am also trying to include a plot. The code does not
Several problems corrected, marked by %%%% or ####
\documentclass[a4paper]{article}
\begin{document}
<>=
x <- rnorm(100)
xm <- mean(x)
xm
@
<>=
x <- rnorm(100)
xm <- mean(x)
xm
@
<>=
##### Remove all comments from your data file
test.frame<-read.table(file="apples.d",header=T,sep= "")
names(test.frame)
head(test.frame)
class(test.frame)
@
\begin{figure}[htbp]
\begin{center}
\setkeys{Gin}{width=0.5\textwidth}
<>=
#### Must tell plot where to get the data from. Could also use test.frame$year
with(test.frame,plot(year,value))
@
\end{center}
\end{figure}
\end{document}