[R] barplot in a loop not printing out to directory

Dimitri Liakhovitski ld7631 at gmail.com
Sat May 16 17:59:12 CEST 2009


Thanks a lot.
The problem was that I was naming my files illegally. I was starting
them with a number. As soon as I changed that, everything worked.
Dimitri

On Sat, May 16, 2009 at 9:12 AM, Jim Lemon <jim at bitwrit.com.au> wrote:
> 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!
>>
>
>



-- 
Dimitri Liakhovitski
MarketTools, Inc.
Dimitri.Liakhovitski at markettools.com




More information about the R-help mailing list