Message-ID: <4A0EBBD3.6030703@bitwrit.com.au>
Date: 2009-05-16T13:12:51Z
From: Jim Lemon
Subject: barplot in a loop not printing out to directory
In-Reply-To: <dae9a2a60905160543w61f079fagb09e80c5ca68ce@mail.gmail.com>
Dimitri Liakhovitski wrote:
> Hello!
> I am experiencing a problem with section 3 of the code below. I want
> to generate barplots (based on data generated in Sections 1 and 2) in
> a loop - for each variable in "data" - and save them as .emf files in
> my current directory. But it's not working - it's printing values to
> be plotted to the screen but does not print the plots themselves
> anywhere (and not in the directory).
> Thank you very much for your help!
> Dimitri
> ...
I would insert a line just after filename=...
cat(filename,"\n")
and see what the filenames are.
Jim
> ### Section 3. I want to generate a barplot based on each and every
> table I produced above and put it in my current directory. But it's
> not working.
>
> for(i in 1:length(tables)) {
> chart.name<-names(data)[i]
> filename=paste(i,chart.name,"emf",sep=".")
> win.metafile(file=filename)
> chart<-barplot(tables[[i]][[2]],xlab = "Values", ylab =
> "Percentages",ylim=c(0,100))
> print(chart)
> dev.off()
> }
>
> Thank you very much!
>