[R] variable driven csv file names?

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Mon Jun 1 10:16:04 CEST 2009


> Is it possible to have variable driven csv file names?  Such as:
> 
> ds.name<-"bob.csv"
> 
> write.table(
>       distribution.data,
>       file = "~//Documents/Research/Distribution Analysis/ds.name",
>       sep = ",",
>       col.names = FALSE,
>       qmethod = "double")

Yes.  You just need to construct your filename string using paste. Replace 
the file argument with

paste("~//Documents/Research/Distribution Analysis/", ds.name, sep="")

Also take a look at ?file.path for platform independent file paths.

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}




More information about the R-help mailing list