[R] name of the graphics output

Duncan Murdoch murdoch at stats.uwo.ca
Tue Mar 14 13:16:25 CET 2006


On 3/14/2006 6:55 AM, Arnau Mir Torres wrote:
> Hello.
> 
> In the file list.txt, I have the name of n files in data frame format. I 
> want to make an image for each file and save the images in pdf format.
> 
> To do this, I do the following:
> 
> llista = scan(file="list.txt",what=list(nom=""))
> for (file.name in llista[[1]]){
>         aux=read.table(file=file.name)
>         aux=as.matrix(aux)
>         pdf()
>         image(aux)
>         system("mv Rplots.pdf file.name.pdf")
>         dev.off()
> }
> 
> All is OK except for the command
> system("mv Rplots.pdf file.name.pdf").
> All the outputs names are file.name.pdf but I want to put a different 
> name for each graphic.
> I have tried
> pdf(file="file.name.pdf") but it doesn't work.

Try pdf(file=paste(file.name,".pdf",sep="").

Duncan Murdoch

> 
> How can I make it?
> 
> Thanks,
> 
> Arnau.
> 
> ______________________________________________
> R-help at 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




More information about the R-help mailing list