Re: [R] output a sequence of plots

From: Don MacQueen <macq_at_llnl.gov>
Date: Thu 06 Oct 2005 - 06:42:30 EST

Something similar to this
(but I haven't tested)

mydf <- data.frame(xx=rnorm(100), yy=rnorm(100), zz=rnorm(100))

for (nm in names(mydf)) {

   fnm <- file.path('c:',paste(nm,'.emf',sep=''))    cat('Creating histogram in file',fnm,'\n')    win.metafile( filename=fnm)

   hist(mydf[[nm]])                                          # or 
hist(mydf[,nm])

   dev.off()

}

-Don

At 11:54 AM -0400 10/5/05, Paul E. Green wrote:
>I can output two histograms of variables
>AXFILTERED and AZPTOP as follows:
>
>win.metafile(filename="C:/AXFILTERED.emf",pointsize=12)
>hist(AXFILTERED,breaks=40)
>dev.off()
>
>win.metafile(filename="C:/AZPTOP.emf",pointsize=12)
>hist(AZPTOP,breaks=40)
>dev.off()
>
>But, I actually have a dataframe of 120 variables that I
>would like histograms of. Any solutions that would
>save me from repeating this code 120 times? Can I
>pass arguments inside quotes? Can I write a function
>to do this?
>
>Paul Green
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Oct 06 06:52:35 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:23:08 EST