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

Girish A.R. garamach at gmail.com
Mon Jun 1 09:00:53 CEST 2009


Hi,

My problem has been solved. Thanks to Renaud Lancelot! Solution pasted
below:

-----------------------------------------------------------------
Plotting functions in package nlme are built using functions of
package lattice. You need to print() the result:

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

Renaud

------------------------------------------------------------
On Jun 1, 10:45 am, "Girish A.R." <garam... at gmail.com> wrote:
> 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-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list