[R] Sweave:Figures from plot (LME output) not getting generated(pdf or eps)

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Jun 2 00:32:45 CEST 2009


Dear Girish,

As they are lattice plots, you need to print() them explicitly. It is
FAQ 7.22:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-
graphics-not-work_003f

<<fig=TRUE>>=
print(plot(fm1, distance ~ fitted(.) | Subject, abline = c(0,1)))
 @ 


------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens Girish A.R.
Verzonden: maandag 1 juni 2009 7:46
Aan: r-help at r-project.org
Onderwerp: [R] Sweave:Figures from plot (LME output) not getting
generated(pdf or eps)

Hi,

I seem to be facing a strange problem when I use Sweave for creating a
LaTeX document of the R lme() output --- The EPS and PDF figure files
get created, but are empty. I have attached a reproducible example below
(taken from the R lme() help example).

------------------------------------------------------------------------
------------
\documentclass[a4paper,10pt]{article}
\usepackage{Sweave}
\SweaveOpts{keep.source=TRUE}
\begin{document}

<<>>=
fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject) @

<<fig=TRUE>>=
plot(fm1, distance ~ fitted(.) | Subject, abline = c(0,1)) @

\end{document}

------------------------------------------------------------------------
------------

I don't seem to face this problem while plotting other objects. Any help
is appreciated.

Thanks,

-Girish


===========================
> sessionInfo()
R version 2.9.0 (2009-04-17)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.
1252;LC_MONETARY=English_United States.
1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] grid      splines   stats     graphics  grDevices utils
datasets  methods
[9] base

other attached packages:
 [1] RWinEdt_1.8-1      coda_0.13-4        verification_1.29
CircStats_0.2-3
 [5] boot_1.2-36        fields_5.02        spam_0.15-4
waveslim_1.6.1
 [9] lmtest_0.9-23      zoo_1.5-5          psychometric_2.1
multilevel_2.3
[13] MASS_7.2-46        nlme_3.1-92        languageR_0.953
lme4_0.999375-31
[17] Matrix_0.999375-26 zipfR_0.6-5        lattice_0.17-22
gplots_2.7.0
[21] caTools_1.9        bitops_1.0-4.1     gdata_2.4.2
gtools_2.5.0-1
[25] gmodels_2.14.1     ggplot2_0.8.3      reshape_0.8.3
plyr_0.1.8
[29] proto_0.3-8        doBy_3.9           foreign_0.8-34
car_1.2-14
[33] Design_2.1-2       survival_2.35-4    Hmisc_3.6-0

loaded via a namespace (and not attached):
[1] cluster_1.12.0   Formula_0.1-3    kinship_1.1.0-22
plm_1.1-2        sandwich_2.2-1
[6] tools_2.9.0

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.




More information about the R-help mailing list