[R] variable as part of file name

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed Jul 2 16:22:03 CEST 2008


On 02.07.2008, at 15:31, Laura Poggio wrote:

> Dear all,
> sorry for this very basic question, but I did not find any good  
> example yet.
>
> I would like to set up a variable that can be recall later to  
> substitute a
> part of a file name.
> As example:
>
> var_filename = as.name("aaa")
>
> jpeg("var_filename.jpg")
> plot()
> dev.off()

try:
var_filename <- 'foo'
jpeg( paste( var_filename, '.jpg', sep='' ) )

See ?paste

--Hans



More information about the R-help mailing list