[R] plot from source file

Thomas Lumley tlumley at u.washington.edu
Thu Oct 4 17:22:27 CEST 2007


It's a FAQ (7.22)

 	-thomas

On Thu, 4 Oct 2007, Armin Goralczyk wrote:

> Dear list
Maybe someone can help with the following problem:
I have a source file containing the following code for plotting:

pdf(file = 'data/mario/boxplot.pdf')
bwplot(sig100 ~ target | group, data = fish, main = 'Boxplot der
Signale in 100 Zellen nach Gruppe', xlab = '', ylab = 'Anzahl der
Signale')
dev.off()

pdf(file = 'data/mario/xyplot.pdf')
xyplot(sig100 ~ target | group, data = fish, main = 'Signale in 100
Zellen nach Gruppen', xlab = '', ylab = 'Anzahl der Signale',
 	panel = function(x,y, ...) {
 		panel.grid(h = -1, v = -1)
 		panel.xyplot(x,y, jitter.x=TRUE)
 		panel.lmline(x,y, lty = 2, col = 3)})
dev.off()

If I run the file from R with
source('lib/analysis_mario.R')
a two pdf-files will be created but they cannot be read.

When I use
source('lib/analysis_mario.R', echo=TRUE)
the files are created correctly.

Actually I don't want the echo, so what can I do to plot correctly and
omit the echo in one run.

I use

platform       powerpc-apple-darwin8.9.1
arch           powerpc
os             darwin8.9.1
system         powerpc, darwin8.9.1
status
major          2
minor          5.1
year           2007
month          06
day            27
svn rev        42083
language       R
version.string R version 2.5.1 (2007-06-27)
-- 
Armin Goralczyk, M.D.
Dept. of General Surgery
University of Gÿÿttingen
Gÿÿttingen, Germany
http://www.chirurgie-goettingen.de
______________________________________________
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.

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle


More information about the R-help mailing list