name of the graphics output

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

name of the graphics output

Arnau Mir Torres
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.

How can I make it?

Thanks,

Arnau.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: name of the graphics output

Philipp Pagel-2
On Tue, Mar 14, 2006 at 12:55:47PM +0100, Arnau Mir Torres wrote:

> All the outputs names are file.name.pdf but I want to put a different
> name for each graphic.

you can use paste() to put together the command:

file ="foo"
system( paste("mv Rplots.pdf ", file,  ".name.pdf", sep='') )

cu
        Philipp

--
Dr. Philipp Pagel                            Tel.  +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics      Fax.  +49-8161-71 2186
Technical University of Munich
Science Center Weihenstephan
85350 Freising, Germany

 and

Institute for Bioinformatics / MIPS          Tel.  +49-89-3187 3675
GSF - National Research Center               Fax.  +49-89-3187 3585
      for Environment and Health
Ingolst├Ądter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/staff/pagel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: name of the graphics output

Duncan Murdoch
In reply to this post by Arnau Mir Torres
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.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: name of the graphics output

Philipp Pagel-2
In reply to this post by Philipp Pagel-2
On Tue, Mar 14, 2006 at 01:03:22PM +0100, Philipp Pagel wrote:
> On Tue, Mar 14, 2006 at 12:55:47PM +0100, Arnau Mir Torres wrote:
>
> > All the outputs names are file.name.pdf but I want to put a different
> > name for each graphic.
>
> you can use paste() to put together the command:
>
> file ="foo"
> system( paste("mv Rplots.pdf ", file,  ".name.pdf", sep='') )

Oops - of course it makes a lot more sense to put together the filename
when opening the pdf device:

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


cu
        Philipp

--
Dr. Philipp Pagel                            Tel.  +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics      Fax.  +49-8161-71 2186
Technical University of Munich
Science Center Weihenstephan
85350 Freising, Germany

 and

Institute for Bioinformatics / MIPS          Tel.  +49-89-3187 3675
GSF - National Research Center               Fax.  +49-89-3187 3585
      for Environment and Health
Ingolst├Ądter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/staff/pagel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html