Sie sind auf Seite 1von 5

Using Sweave with beamer in LYX

Yihui Xie1

January 9, 2013

many thanks to Liviu Andronic who contributed the beamer-fragile.module;


a PDF version of this example is at
https://bitbucket.org/stat/lyx/downloads/lyx-sweave-beamer.pdf

Requirements

you cannot use Sweave directly with beamer in LYX, since LYX
does not have direct support for fragile frames

see FAQ 1 in the Sweave manual in LYX for details (N.B. not
the Sweave manual in R!)
I

https:
//bitbucket.org/stat/lyx/downloads/sweave.pdf

A fragile frame with R code


> options(width = 60, useFancyQuotes = FALSE)
> summary(lm(mpg ~ hp, data = mtcars))
Call:
lm(formula = mpg ~ hp, data = mtcars)
Residuals:
Min
1Q Median
-5.7121 -2.1122 -0.8854

3Q
1.5819

Max
8.2360

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 30.09886
1.63392 18.421 < 2e-16 ***
hp
-0.06823
0.01012 -6.742 1.79e-07 ***
--Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 '
Residual standard error: 3.863 on 30 degrees of freedom
Multiple R-squared: 0.6024, Adjusted R-squared: 0.5892

A fragile frame spans over two pages I


> summary(mtcars)
mpg
Min.
:10.40
1st Qu.:15.43
Median :19.20
Mean
:20.09
3rd Qu.:22.80
Max.
:33.90
hp
Min.
: 52.0
1st Qu.: 96.5
Median :123.0
Mean
:146.7
3rd Qu.:180.0
Max.
:335.0
qsec

cyl
Min.
:4.000
1st Qu.:4.000
Median :6.000
Mean
:6.188
3rd Qu.:8.000
Max.
:8.000
drat
Min.
:2.760
1st Qu.:3.080
Median :3.695
Mean
:3.597
3rd Qu.:3.920
Max.
:4.930
vs

disp
Min.
: 71.1
1st Qu.:120.8
Median :196.3
Mean
:230.7
3rd Qu.:326.0
Max.
:472.0
wt
Min.
:1.513
1st Qu.:2.581
Median :3.325
Mean
:3.217
3rd Qu.:3.610
Max.
:5.424
am

A fragile frame spans over two pages II


Min.
:14.50
1st Qu.:16.89
Median :17.71
Mean
:17.85
3rd Qu.:18.90
Max.
:22.90
gear
Min.
:3.000
1st Qu.:3.000
Median :4.000
Mean
:3.688
3rd Qu.:4.000
Max.
:5.000

Min.
:0.0000
1st Qu.:0.0000
Median :0.0000
Mean
:0.4375
3rd Qu.:1.0000
Max.
:1.0000
carb
Min.
:1.000
1st Qu.:2.000
Median :2.000
Mean
:2.812
3rd Qu.:4.000
Max.
:8.000

Min.
:0.0000
1st Qu.:0.0000
Median :0.0000
Mean
:0.4062
3rd Qu.:1.0000
Max.
:1.0000

Das könnte Ihnen auch gefallen