The document that follows has been generated from original Sweave (\textbf{.Rnw}) files. Details are in the document \textbf{Sweave-info.pdf}. \section{Command Line Calculations} [In the book, calculations are mostly performed by typing commands on the command line.] Practice in the evaluation of arithmetic expressions will help develop the needed conceptual and keyboard skills. Here are simple examples: <>= 2*3*4*5 # * denotes 'multiply' sqrt(10) # the square root of 10 pi # R knows about pi 2*pi*6378 # Circumference of earth at equator (km) # (radius at equator is 6378 km) @% {\small \noindent \textbf{Note:} Unfortunately, \texttt{Sweave()} strips any comments from the code. The code that was input to Sweave was: \begin{verbatim} 2*3*4*5 # * denotes 'multiply' sqrt(10) # the square root of 10 pi # R knows about pi 2*pi*6378 # Circumference of earth at equator (km) # (radius at equator is 6378 km) \end{verbatim} } \section{Plotting a Graph} Type in data and draw Figure 1: \begin{figure}[H] \begin{center} <>= Year <- c(1800, 1850, 1900, 1950, 2000) Carbon <- c(8, 54, 534, 1630, 6611) ## Now plot Carbon as a function of Year plot(Carbon ~ Year, pch=16) @ \caption{Plot of annual totals of carbon emissions (millions of tonnes), against year} \end{center} \end{figure}