Make sweave example working. Patch from Liviu.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37220 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2011-01-15 20:30:02 +00:00
parent 9d76ec23d5
commit a33aa0632d

View File

@ -1,5 +1,5 @@
#LyX 1.6.1 created this file. For more info see http://www.lyx.org/ #LyX 2.0.0svn created this file. For more info see http://www.lyx.org/
\lyxformat 345 \lyxformat 410
\begin_document \begin_document
\begin_header \begin_header
\textclass article \textclass article
@ -7,18 +7,25 @@
\begin_modules \begin_modules
sweave sweave
\end_modules \end_modules
\maintain_unincluded_children false
\language english \language english
\inputencoding auto \inputencoding auto
\font_roman default \fontencoding global
\font_sans default \font_roman lmodern
\font_typewriter default \font_sans lmss
\font_typewriter lmtt
\font_default_family default \font_default_family default
\use_non_tex_fonts false
\font_sc false \font_sc false
\font_osf false \font_osf false
\font_sf_scale 100 \font_sf_scale 100
\font_tt_scale 100 \font_tt_scale 100
\graphics default \graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default \paperfontsize default
\spacing single \spacing single
\use_hyperref false \use_hyperref false
@ -26,9 +33,18 @@ sweave
\use_geometry false \use_geometry false
\use_amsmath 1 \use_amsmath 1
\use_esint 1 \use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic \cite_engine basic
\use_bibtopic false \use_bibtopic false
\use_indices false
\paperorientation portrait \paperorientation portrait
\suppress_date false
\use_refstyle 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3 \secnumdepth 3
\tocdepth 3 \tocdepth 3
\paragraph_separation skip \paragraph_separation skip
@ -39,8 +55,8 @@ sweave
\paperpagestyle default \paperpagestyle default
\tracking_changes false \tracking_changes false
\output_changes false \output_changes false
\author "" \html_math_output 0
\author "" \html_be_strict false
\end_header \end_header
\begin_body \begin_body
@ -78,21 +94,21 @@ A simple example that will run in any S engine: The integers from 1 to 10
\begin_layout Chunk \begin_layout Chunk
<<print=TRUE>>= <<print=TRUE>>=
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
1:10 1:10
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
<<results=hide>>= <<results=hide>>=
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
print(1:20) print(1:20)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
@ % the above is just to ensure that 2 code chunks can follow each other @ % the above is just to ensure that 2 code chunks can follow each other
\end_layout \end_layout
@ -102,21 +118,21 @@ We can also emulate a simple calculator:
\begin_layout Chunk \begin_layout Chunk
<<echo=TRUE,print=TRUE>>= <<echo=TRUE,print=TRUE>>=
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
1 + 1 1 + 1
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
1 + pi 1 + pi
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
sin(pi/2) sin(pi/2)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
@ @
\end_layout \end_layout
@ -126,25 +142,25 @@ Now we look at Gaussian data:
\begin_layout Chunk \begin_layout Chunk
<<>>= <<>>=
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
library(stats) library(stats)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
x <- rnorm(20) x <- rnorm(20)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
print(x) print(x)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
print(t1 <- t.test(x)) print(t1 <- t.test(x))
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
@ @
\end_layout \end_layout
@ -213,21 +229,21 @@ echo=true,keep.source=true
\begin_layout Chunk \begin_layout Chunk
<<engine=R>>= <<engine=R>>=
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
# A comment # A comment
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
data(iris) data(iris)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
summary(iris) summary(iris)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
@ % def @ % def
\end_layout \end_layout
@ -236,25 +252,39 @@ summary(iris)
placement tbph placement tbph
wide false wide false
sideways false sideways false
status collapsed status open
\begin_layout Chunk \begin_layout Plain Layout
\noindent
\align center \align center
\begin_inset ERT
status open
\begin_layout Plain Layout
<<fig=TRUE>>= <<fig=TRUE>>=
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Plain Layout
library(graphics) library(graphics)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Plain Layout
pairs(iris) pairs(iris)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Plain Layout
@ @
\end_layout \end_layout
\end_inset
\end_layout
\begin_layout Plain Layout \begin_layout Plain Layout
\begin_inset Caption \begin_inset Caption
@ -277,21 +307,34 @@ Pairs plot of the iris data.
placement tbph placement tbph
wide false wide false
sideways false sideways false
status collapsed status open
\begin_layout Chunk \begin_layout Plain Layout
\noindent
\align center \align center
\begin_inset ERT
status open
\begin_layout Plain Layout
<<fig=true>>= <<fig=true>>=
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Plain Layout
boxplot(Sepal.Length~Species,data=iris) boxplot(Sepal.Length~Species,data=iris)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Plain Layout
@ @
\end_layout \end_layout
\end_inset
\end_layout
\begin_layout Plain Layout \begin_layout Plain Layout
\begin_inset Caption \begin_inset Caption
@ -311,13 +354,13 @@ Boxplot of sepal length grouped by species.
\begin_layout Chunk \begin_layout Chunk
<<engine=S4>>= <<engine=S4>>=
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
function.that.comes.only.with.Splus(x) function.that.comes.only.with.Splus(x)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Chunk
@ @
\end_layout \end_layout
@ -327,19 +370,32 @@ wide false
sideways false sideways false
status open status open
\begin_layout Chunk \begin_layout Plain Layout
\noindent
\align center \align center
\begin_inset ERT
status open
\begin_layout Plain Layout
<<fig=true>>= <<fig=true>>=
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Plain Layout
boxplot(Sepal.Length~Species,data=iris) boxplot(Sepal.Length~Species,data=iris)
\begin_inset Newline newline \end_layout
\end_inset
\begin_layout Plain Layout
@ @
\end_layout \end_layout
\end_inset
\end_layout
\begin_layout Plain Layout \begin_layout Plain Layout
\begin_inset Caption \begin_inset Caption