On 8/4/07, Donatas G. <[EMAIL PROTECTED]> wrote:
> I have a data.frame with ~100 columns and I need a barplot for each column
> produced and saved in some directory.
>
> I am not sure it is possible - so please help me.
>
> this is my loop that does not work...
>
> vars <- list (substitute (G01_01), substitute (G01_02), substitute (G01_03),
> substitute (G01_04))
> results <- data.frame ('Variable Name'=rep (NA, length (vars)),
> check.names=FALSE)
> for (i in 1:length (vars))  {
> barplot(table(i),xlab=i,ylab="NuomonÄ—s")
> dev.copy(png, filename="/my/dir/barplot.i.png", height=600, width=600)
> dev.off()
> }
>
> questions:
>
> Is it possible to use the i somewhere _within_ a file name? (like it is
> possible in other programming or scripting languages?)

(Yes, but) Why are you using dev.copy? See ?png, in particular how the
``page number'' can be encoded in the 'filename' argument for
multi-page output.

-Deepayan

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to