1 \documentclass{article}
3 \usepackage[margin=1in]{geometry}
5 \setlength{\parindent}{0in}
7 \title{A Simple Sweave Document using Caching}
10 \SweaveOpts{eps=false}
16 First we load the packages which contain the data and functions that
23 We fit a linear model to the \texttt{airquality} dataset. In this
24 code chunk we will turn caching on so that we cache the
25 \texttt{airquality} data frame and the \texttt{fit} object.
26 <<FitLinearModel,cache=true>>=
28 fit <- lm(Ozone ~ Temp + Wind + Solar.R, data = airquality)
31 We can summarize the regression coefficients and their uncertainties
33 <<CoefficientTable,results=tex>>=
38 We can also plot some model diagnostics.
41 <<LinearModelDiagnosticPlots,fig=true>>=
42 oldpar <- par(no.readonly = TRUE)
44 plot(fit, ask = FALSE)
47 \caption{Linear model diagnostic plots}