mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Accept modifications in R examples
This commit is contained in:
parent
6b0381b386
commit
47612b3839
@ -1,5 +1,5 @@
|
|||||||
#LyX 2.3 created this file. For more info see http://www.lyx.org/
|
#LyX 2.3 created this file. For more info see http://www.lyx.org/
|
||||||
\lyxformat 541
|
\lyxformat 544
|
||||||
\begin_document
|
\begin_document
|
||||||
\begin_header
|
\begin_header
|
||||||
\save_transient_properties true
|
\save_transient_properties true
|
||||||
@ -55,6 +55,7 @@ knitr
|
|||||||
\suppress_date false
|
\suppress_date false
|
||||||
\justification true
|
\justification true
|
||||||
\use_refstyle 1
|
\use_refstyle 1
|
||||||
|
\use_minted 0
|
||||||
\index Index
|
\index Index
|
||||||
\shortcut idx
|
\shortcut idx
|
||||||
\color #008000
|
\color #008000
|
||||||
@ -68,16 +69,17 @@ knitr
|
|||||||
\paragraph_separation indent
|
\paragraph_separation indent
|
||||||
\paragraph_indentation default
|
\paragraph_indentation default
|
||||||
\is_math_indent 0
|
\is_math_indent 0
|
||||||
|
\math_numbering_side default
|
||||||
\quotes_style english
|
\quotes_style english
|
||||||
|
\dynamic_quotes 0
|
||||||
\papercolumns 1
|
\papercolumns 1
|
||||||
\papersides 1
|
\papersides 1
|
||||||
\paperpagestyle default
|
\paperpagestyle default
|
||||||
\tracking_changes true
|
\tracking_changes false
|
||||||
\output_changes false
|
\output_changes false
|
||||||
\html_math_output 0
|
\html_math_output 0
|
||||||
\html_css_as_file 0
|
\html_css_as_file 0
|
||||||
\html_be_strict false
|
\html_be_strict false
|
||||||
\author 2047637253 "Guillaume Munch"
|
|
||||||
\end_header
|
\end_header
|
||||||
|
|
||||||
\begin_body
|
\begin_body
|
||||||
@ -208,13 +210,9 @@ knitr
|
|||||||
\series default
|
\series default
|
||||||
; many of the examples have links to the \SpecialChar LyX
|
; many of the examples have links to the \SpecialChar LyX
|
||||||
source documents.
|
source documents.
|
||||||
\change_inserted 2047637253 1483899260
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483899275
|
|
||||||
Since \SpecialChar LyX
|
Since \SpecialChar LyX
|
||||||
2.3, it is necessary to enable the use of
|
2.3, it is necessary to enable the use of
|
||||||
\emph on
|
\emph on
|
||||||
@ -231,8 +229,6 @@ Converters
|
|||||||
knitr
|
knitr
|
||||||
\series default
|
\series default
|
||||||
.
|
.
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
@ -246,24 +242,16 @@ knitr
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483899195
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483899204
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483899200
|
|
||||||
show-off
|
show-off
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
@ -273,47 +261,6 @@ show-off
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483899204
|
|
||||||
|
|
||||||
rnorm(5)
|
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
|
|
||||||
\change_inserted 2047637253 1483899204
|
|
||||||
|
|
||||||
df=data.frame(y=rnorm(100), x=1:100)
|
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
|
|
||||||
\change_inserted 2047637253 1483899204
|
|
||||||
|
|
||||||
summary(lm(y~x, data=df))
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\begin_layout Standard
|
|
||||||
|
|
||||||
\change_deleted 2047637253 1483899208
|
|
||||||
\begin_inset ERT
|
|
||||||
status open
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
|
|
||||||
<<show-off>>=
|
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
|
|
||||||
rnorm(5)
|
rnorm(5)
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -327,16 +274,9 @@ df=data.frame(y=rnorm(100), x=1:100)
|
|||||||
summary(lm(y~x, data=df))
|
summary(lm(y~x, data=df))
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
|
|
||||||
@
|
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#LyX 2.3 created this file. For more info see http://www.lyx.org/
|
#LyX 2.3 created this file. For more info see http://www.lyx.org/
|
||||||
\lyxformat 541
|
\lyxformat 544
|
||||||
\begin_document
|
\begin_document
|
||||||
\begin_header
|
\begin_header
|
||||||
\save_transient_properties true
|
\save_transient_properties true
|
||||||
@ -67,6 +67,7 @@ sweave
|
|||||||
\suppress_date false
|
\suppress_date false
|
||||||
\justification true
|
\justification true
|
||||||
\use_refstyle 0
|
\use_refstyle 0
|
||||||
|
\use_minted 0
|
||||||
\index Index
|
\index Index
|
||||||
\shortcut idx
|
\shortcut idx
|
||||||
\color #008000
|
\color #008000
|
||||||
@ -80,36 +81,31 @@ sweave
|
|||||||
\paragraph_separation indent
|
\paragraph_separation indent
|
||||||
\paragraph_indentation default
|
\paragraph_indentation default
|
||||||
\is_math_indent 0
|
\is_math_indent 0
|
||||||
|
\math_numbering_side default
|
||||||
\quotes_style english
|
\quotes_style english
|
||||||
|
\dynamic_quotes 0
|
||||||
\papercolumns 1
|
\papercolumns 1
|
||||||
\papersides 1
|
\papersides 1
|
||||||
\paperpagestyle default
|
\paperpagestyle default
|
||||||
\tracking_changes true
|
\tracking_changes false
|
||||||
\output_changes false
|
\output_changes false
|
||||||
\html_math_output 0
|
\html_math_output 0
|
||||||
\html_css_as_file 0
|
\html_css_as_file 0
|
||||||
\html_be_strict false
|
\html_be_strict false
|
||||||
\author 2047637253 "Guillaume Munch"
|
|
||||||
\end_header
|
\end_header
|
||||||
|
|
||||||
\begin_body
|
\begin_body
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897614
|
|
||||||
\begin_inset Note Note
|
\begin_inset Note Note
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897614
|
|
||||||
\begin_inset Flex Sweave Options
|
\begin_inset Flex Sweave Options
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897614
|
|
||||||
|
|
||||||
prefix=TRUE,prefix.string=sweave-prefix,keep.source=FALSE
|
prefix=TRUE,prefix.string=sweave-prefix,keep.source=FALSE
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -121,8 +117,6 @@ prefix=TRUE,prefix.string=sweave-prefix,keep.source=FALSE
|
|||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
@ -259,13 +253,9 @@ https://github.com/downloads/yihui/lyx/sweave.pdf
|
|||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
.
|
.
|
||||||
\change_inserted 2047637253 1483898587
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483899123
|
|
||||||
Since \SpecialChar LyX
|
Since \SpecialChar LyX
|
||||||
2.3, it is necessary to enable the use of
|
2.3, it is necessary to enable the use of
|
||||||
\emph on
|
\emph on
|
||||||
@ -278,8 +268,6 @@ File Handling\SpecialChar menuseparator
|
|||||||
Converters
|
Converters
|
||||||
\family default
|
\family default
|
||||||
in order to compile with Sweave.
|
in order to compile with Sweave.
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Section
|
\begin_layout Section
|
||||||
@ -347,21 +335,15 @@ bin
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897627
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897627
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897627
|
|
||||||
where-is-R-bin,eval=FALSE
|
where-is-R-bin,eval=FALSE
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -372,16 +354,12 @@ where-is-R-bin,eval=FALSE
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897627
|
|
||||||
|
|
||||||
R.home('bin')
|
R.home('bin')
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
@ -416,21 +394,15 @@ Sweave.sty
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897639
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897639
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897639
|
|
||||||
sweave-sty,eval=FALSE
|
sweave-sty,eval=FALSE
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -441,16 +413,12 @@ sweave-sty,eval=FALSE
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897639
|
|
||||||
|
|
||||||
file.path(R.home('share'), 'texmf', 'tex', 'latex')
|
file.path(R.home('share'), 'texmf', 'tex', 'latex')
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
@ -524,37 +492,20 @@ echo=FALSE
|
|||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
To write R code in \SpecialChar LyX
|
To write R code in \SpecialChar LyX
|
||||||
, you can first
|
, you can first insert
|
||||||
\change_inserted 2047637253 1483898412
|
|
||||||
insert
|
|
||||||
\change_deleted 2047637253 1483898419
|
|
||||||
switch to the
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\family typewriter
|
\family typewriter
|
||||||
Chunk
|
Chunk
|
||||||
\family default
|
\family default
|
||||||
|
insets from
|
||||||
\change_inserted 2047637253 1483898437
|
|
||||||
insets from
|
|
||||||
\family sans
|
\family sans
|
||||||
Insert\SpecialChar menuseparator
|
Insert\SpecialChar menuseparator
|
||||||
Custom Insets\SpecialChar menuseparator
|
Custom Insets\SpecialChar menuseparator
|
||||||
Chunk
|
Chunk
|
||||||
\change_deleted 2047637253 1483898459
|
|
||||||
|
|
||||||
\family default
|
\family default
|
||||||
environment in the layout styles list (droplist in the top-left corner in
|
|
||||||
the toolbar)
|
|
||||||
\change_unchanged
|
|
||||||
, or you can simply open a \SpecialChar TeX
|
, or you can simply open a \SpecialChar TeX
|
||||||
code environment and write Sweave code chunks
|
code environment and write Sweave code chunks
|
||||||
in it.
|
in it.
|
||||||
|
However, \SpecialChar LyX
|
||||||
\change_deleted 2047637253 1483898024
|
|
||||||
The latter approach is recommended since it is more stable.
|
|
||||||
\change_inserted 2047637253 1483961753
|
|
||||||
However, \SpecialChar LyX
|
|
||||||
provides a summary of all the
|
provides a summary of all the
|
||||||
\family typewriter
|
\family typewriter
|
||||||
Chunk
|
Chunk
|
||||||
@ -570,8 +521,6 @@ View\SpecialChar menuseparator
|
|||||||
Outline Pane
|
Outline Pane
|
||||||
\family default
|
\family default
|
||||||
menus.
|
menus.
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
@ -591,21 +540,15 @@ useFancyQuotes
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897653
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897653
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897653
|
|
||||||
setup, keep.source=TRUE
|
setup, keep.source=TRUE
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -616,15 +559,11 @@ setup, keep.source=TRUE
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897653
|
|
||||||
|
|
||||||
## the option 'digits' can set the (approximate) number of digits
|
## the option 'digits' can set the (approximate) number of digits
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897653
|
|
||||||
|
|
||||||
options(width = 70, useFancyQuotes = FALSE, digits = 4)
|
options(width = 70, useFancyQuotes = FALSE, digits = 4)
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -634,21 +573,15 @@ options(width = 70, useFancyQuotes = FALSE, digits = 4)
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897653
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897653
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897653
|
|
||||||
sweave-manual, eval=FALSE, keep.source=TRUE
|
sweave-manual, eval=FALSE, keep.source=TRUE
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -659,23 +592,17 @@ sweave-manual, eval=FALSE, keep.source=TRUE
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897653
|
|
||||||
|
|
||||||
## view the Sweave vignette (requires R >= 2.13.0)
|
## view the Sweave vignette (requires R >= 2.13.0)
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897653
|
|
||||||
|
|
||||||
vignette("Sweave", package = "utils")
|
vignette("Sweave", package = "utils")
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
@ -683,21 +610,15 @@ A simple example that will run in any S engine:
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897659
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897659
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897659
|
|
||||||
print-integers, keep.source=TRUE
|
print-integers, keep.source=TRUE
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -708,15 +629,11 @@ print-integers, keep.source=TRUE
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897659
|
|
||||||
|
|
||||||
## the integers from 1 to 10 are
|
## the integers from 1 to 10 are
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897659
|
|
||||||
|
|
||||||
1:10
|
1:10
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -726,21 +643,15 @@ print-integers, keep.source=TRUE
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897659
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897659
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897659
|
|
||||||
hide-results, results=hide
|
hide-results, results=hide
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -751,23 +662,17 @@ hide-results, results=hide
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897659
|
|
||||||
|
|
||||||
## intentionally hide the output by setting results=hide
|
## intentionally hide the output by setting results=hide
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897659
|
|
||||||
|
|
||||||
print(1:20)
|
print(1:20)
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
@ -775,21 +680,15 @@ We can also emulate a simple calculator:
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897665
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897665
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897665
|
|
||||||
calculator
|
calculator
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -800,23 +699,17 @@ calculator
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897665
|
|
||||||
|
|
||||||
1 + pi
|
1 + pi
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897665
|
|
||||||
|
|
||||||
sin(pi/6)
|
sin(pi/6)
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
@ -824,21 +717,15 @@ Now we look at some Gaussian data:
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897670
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897670
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897670
|
|
||||||
rnorm
|
rnorm
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -849,37 +736,27 @@ rnorm
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897670
|
|
||||||
|
|
||||||
set.seed(123) # for reproducibility
|
set.seed(123) # for reproducibility
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897670
|
|
||||||
|
|
||||||
x <- rnorm(20)
|
x <- rnorm(20)
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897670
|
|
||||||
|
|
||||||
print(x)
|
print(x)
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897670
|
|
||||||
|
|
||||||
t1 <- t.test(x)
|
t1 <- t.test(x)
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
@ -975,21 +852,15 @@ iris
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897677
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897677
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897677
|
|
||||||
iris-summary
|
iris-summary
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -1000,16 +871,12 @@ iris-summary
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897677
|
|
||||||
|
|
||||||
summary(iris[,-5])
|
summary(iris[,-5])
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
@ -1039,24 +906,16 @@ name "tab:xtable-demo"
|
|||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897685
|
|
||||||
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897698
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897692
|
|
||||||
xtable-demo,results=tex,echo=FALSE
|
xtable-demo,results=tex,echo=FALSE
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
@ -1066,33 +925,23 @@ xtable-demo,results=tex,echo=FALSE
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897699
|
|
||||||
|
|
||||||
if (require('xtable')) {
|
if (require('xtable')) {
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897699
|
|
||||||
|
|
||||||
print(xtable(sapply(iris[,-5], quantile)), floating=FALSE)
|
print(xtable(sapply(iris[,-5], quantile)), floating=FALSE)
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897699
|
|
||||||
|
|
||||||
} else cat('the xtable package is not available! please install.packages("xtable"
|
} else cat('the xtable package is not available! please install.packages("xtable"
|
||||||
)')
|
)')
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
@ -1179,24 +1028,16 @@ Both eps and pdf are set to true so that both latex and pdflatex work.
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
\align center
|
\align center
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897765
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897772
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897770
|
|
||||||
iris-pairs,fig=TRUE,width=4.5,height=4.5,eps=TRUE,pdf=TRUE
|
iris-pairs,fig=TRUE,width=4.5,height=4.5,eps=TRUE,pdf=TRUE
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
@ -1206,18 +1047,12 @@ iris-pairs,fig=TRUE,width=4.5,height=4.5,eps=TRUE,pdf=TRUE
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897776
|
|
||||||
|
|
||||||
pairs(iris, col = iris$Species)
|
pairs(iris, col = iris$Species)
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
@ -1256,21 +1091,15 @@ status open
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
\align center
|
\align center
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897883
|
|
||||||
\begin_inset Flex Chunk
|
\begin_inset Flex Chunk
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897883
|
|
||||||
|
|
||||||
\begin_inset Argument 1
|
\begin_inset Argument 1
|
||||||
status open
|
status open
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897883
|
|
||||||
iris-boxplots,fig=TRUE,width=7,height=2,keep.source=F,eps=T,pdf=T
|
iris-boxplots,fig=TRUE,width=7,height=2,keep.source=F,eps=T,pdf=T
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -1281,23 +1110,17 @@ iris-boxplots,fig=TRUE,width=7,height=2,keep.source=F,eps=T,pdf=T
|
|||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897883
|
|
||||||
|
|
||||||
par(mar=c(4,5,.1,.3), las=1)
|
par(mar=c(4,5,.1,.3), las=1)
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
|
|
||||||
\change_inserted 2047637253 1483897883
|
|
||||||
|
|
||||||
boxplot(Sepal.Length~Species,data=iris,horizontal=TRUE,xlab='Sepal.Length')
|
boxplot(Sepal.Length~Species,data=iris,horizontal=TRUE,xlab='Sepal.Length')
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
\begin_layout Plain Layout
|
||||||
@ -1337,8 +1160,6 @@ R/S code
|
|||||||
R CMD Stangle
|
R CMD Stangle
|
||||||
\family default
|
\family default
|
||||||
.
|
.
|
||||||
\change_inserted 2047637253 1483898877
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Section
|
\begin_layout Section
|
||||||
@ -1699,17 +1520,9 @@ label=
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
Another
|
Another issue with the \SpecialChar TeX
|
||||||
\change_deleted 2047637253 1483899012
|
code environment is the Sweave code chunk may fail
|
||||||
known
|
when we change the alignment of the chunk paragraph in \SpecialChar LyX
|
||||||
\change_unchanged
|
|
||||||
issue
|
|
||||||
\change_inserted 2047637253 1483898966
|
|
||||||
with the \SpecialChar TeX
|
|
||||||
code environment
|
|
||||||
\change_unchanged
|
|
||||||
is the Sweave code chunk may fail when we change the alignment of the chunk
|
|
||||||
paragraph in \SpecialChar LyX
|
|
||||||
(using
|
(using
|
||||||
\family sans
|
\family sans
|
||||||
Paragraph settings
|
Paragraph settings
|
||||||
@ -1761,36 +1574,10 @@ This is not a legitimate Sweave code chunk, since
|
|||||||
<<>>=
|
<<>>=
|
||||||
\family default
|
\family default
|
||||||
must start in a new line with nothing before it.
|
must start in a new line with nothing before it.
|
||||||
|
|
||||||
\change_inserted 2047637253 1483899083
|
|
||||||
This does not happen when using the Chunk inset instead of the \SpecialChar TeX
|
This does not happen when using the Chunk inset instead of the \SpecialChar TeX
|
||||||
code environmen
|
code environmen
|
||||||
t.
|
t.
|
||||||
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\change_deleted 2047637253 1483898988
|
|
||||||
Therefore we recommend you to double check the real source code via
|
|
||||||
\family sans
|
|
||||||
View\SpecialChar menuseparator
|
|
||||||
View Source
|
|
||||||
\family default
|
|
||||||
when changing the alignment of a chunk paragraph, and make sure
|
|
||||||
\family typewriter
|
|
||||||
<<>>=
|
|
||||||
\family default
|
|
||||||
appears in a new line.
|
|
||||||
This explains why we manually added an empty line in the code chunk in
|
|
||||||
Table
|
|
||||||
\begin_inset CommandInset ref
|
|
||||||
LatexCommand ref
|
|
||||||
reference "tab:xtable-demo"
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
.
|
|
||||||
\change_unchanged
|
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Section
|
\begin_layout Section
|
||||||
|
Loading…
Reference in New Issue
Block a user