]> git.lyx.org Git - lyx.git/blob - lib/examples/Modules/Rnw_%28knitr%29.lyx
Update sk.po
[lyx.git] / lib / examples / Modules / Rnw_%28knitr%29.lyx
1 #LyX 2.4 created this file. For more info see https://www.lyx.org/
2 \lyxformat 620
3 \begin_document
4 \begin_header
5 \save_transient_properties true
6 \origin /systemlyxdir/examples/Modules/
7 \textclass article
8 \use_default_options true
9 \begin_modules
10 knitr
11 \end_modules
12 \maintain_unincluded_children no
13 \language english
14 \language_package default
15 \inputencoding utf8
16 \fontencoding auto
17 \font_roman "palatino" "default"
18 \font_sans "lmss" "default"
19 \font_typewriter "lmtt" "default"
20 \font_math "auto" "auto"
21 \font_default_family default
22 \use_non_tex_fonts false
23 \font_sc false
24 \font_roman_osf false
25 \font_sans_osf false
26 \font_typewriter_osf false
27 \font_sf_scale 100 100
28 \font_tt_scale 100 100
29 \use_microtype false
30 \use_dash_ligatures false
31 \graphics default
32 \default_output_format default
33 \output_sync 0
34 \bibtex_command default
35 \index_command default
36 \paperfontsize default
37 \spacing single
38 \use_hyperref false
39 \papersize default
40 \use_geometry true
41 \use_package amsmath 1
42 \use_package amssymb 1
43 \use_package cancel 1
44 \use_package esint 1
45 \use_package mathdots 1
46 \use_package mathtools 1
47 \use_package mhchem 1
48 \use_package stackrel 1
49 \use_package stmaryrd 1
50 \use_package undertilde 1
51 \cite_engine basic
52 \cite_engine_type default
53 \biblio_style plain
54 \use_bibtopic false
55 \use_indices false
56 \paperorientation portrait
57 \suppress_date false
58 \justification true
59 \use_refstyle 1
60 \use_minted 0
61 \use_lineno 0
62 \index Index
63 \shortcut idx
64 \color #008000
65 \end_index
66 \leftmargin 2.5cm
67 \topmargin 2.5cm
68 \rightmargin 2.5cm
69 \bottommargin 2.5cm
70 \secnumdepth 3
71 \tocdepth 3
72 \paragraph_separation indent
73 \paragraph_indentation default
74 \is_math_indent 0
75 \math_numbering_side default
76 \quotes_style english
77 \dynamic_quotes 0
78 \papercolumns 1
79 \papersides 1
80 \paperpagestyle default
81 \tablestyle default
82 \tracking_changes false
83 \output_changes false
84 \change_bars false
85 \postpone_fragile_content false
86 \html_math_output 0
87 \html_css_as_file 0
88 \html_be_strict false
89 \docbook_table_output 0
90 \docbook_mathml_prefix 1
91 \end_header
92
93 \begin_body
94
95 \begin_layout Title
96 Using knitr with \SpecialChar LyX
97
98 \end_layout
99
100 \begin_layout Author
101 Yihui Xie
102 \begin_inset Foot
103 status collapsed
104
105 \begin_layout Plain Layout
106 Department of Statistics,
107  Iowa State University.
108  Email:
109  
110 \begin_inset CommandInset href
111 LatexCommand href
112 name "xie@yihui.name"
113 target "xie@yihui.name"
114 type "mailto:"
115 literal "false"
116
117 \end_inset
118
119
120 \end_layout
121
122 \end_inset
123
124
125 \end_layout
126
127 \begin_layout Standard
128 The R (
129 \begin_inset Flex URL
130 status collapsed
131
132 \begin_layout Plain Layout
133
134 http://www.r-project.org
135 \end_layout
136
137 \end_inset
138
139 ) package 
140 \series bold
141 knitr
142 \series default
143  is an alternative tool to Sweave based on a different design with more features.
144  \SpecialChar LyX
145  has native support to Sweave since version 2.0.0,
146  and the support to 
147 \series bold
148 knitr
149 \series default
150  was also added since 2.0.3.
151  The usage is basically the same as the 
152 \family sans
153 Sweave
154 \family default
155  module
156 \begin_inset Foot
157 status open
158
159 \begin_layout Plain Layout
160 read the \SpecialChar LyX
161 /Sweave manual from 
162 \family sans
163 Help\SpecialChar menuseparator
164 Specific Manuals
165 \end_layout
166
167 \end_inset
168
169 :
170 \end_layout
171
172 \begin_layout Enumerate
173 Open a new \SpecialChar LyX
174  document;
175 \end_layout
176
177 \begin_layout Enumerate
178 Go to 
179 \family sans
180 Document\SpecialChar menuseparator
181 Settings\SpecialChar menuseparator
182 Modules
183 \family default
184  and insert the module named 
185 \family sans
186 Rnw (knitr)
187 \family default
188 ;
189 \end_layout
190
191 \begin_layout Enumerate
192 Then insert R code in the document with either 
193 \family sans
194 Insert\SpecialChar menuseparator
195 \SpecialChar TeX
196  Code
197 \family default
198  or the 
199 \family sans
200 Chunk
201 \family default
202  environment;
203 \end_layout
204
205 \begin_layout Standard
206 The package website 
207 \begin_inset Flex URL
208 status collapsed
209
210 \begin_layout Plain Layout
211
212 http://yihui.name/knitr
213 \end_layout
214
215 \end_inset
216
217  has full documentation and demos of 
218 \series bold
219 knitr
220 \series default
221 ;
222  many of the examples have links to the \SpecialChar LyX
223  source documents.
224 \end_layout
225
226 \begin_layout Standard
227 Since \SpecialChar LyX
228  2.3,
229  it is necessary to enable the use of 
230 \emph on
231 needauth
232 \emph default
233  converters in
234 \family sans
235  Preferences\SpecialChar menuseparator
236 File Handling\SpecialChar menuseparator
237 Converters
238 \family default
239  in order to compile with 
240 \series bold
241 knitr
242 \series default
243 .
244 \end_layout
245
246 \begin_layout Standard
247 Note the 
248 \series bold
249 knitr
250 \series default
251  package requires R >= 2.14.1,
252  so you need to update R if you are using an old version of R.
253  Here we show one chunk as a simple example:
254 \end_layout
255
256 \begin_layout Standard
257 \begin_inset Flex Chunk
258 status open
259
260 \begin_layout Plain Layout
261
262 \begin_inset Argument 1
263 status open
264
265 \begin_layout Plain Layout
266
267 show-off
268 \end_layout
269
270 \end_inset
271
272
273 \end_layout
274
275 \begin_layout Plain Layout
276
277 rnorm(5)
278 \end_layout
279
280 \begin_layout Plain Layout
281
282 df=data.frame(y=rnorm(100),
283  x=1:100)
284 \end_layout
285
286 \begin_layout Plain Layout
287
288 summary(lm(y~x,
289  data=df))
290 \end_layout
291
292 \end_inset
293
294
295 \end_layout
296
297 \begin_layout Standard
298 Please contact the package author in case of any problems.
299 \end_layout
300
301 \end_body
302 \end_document