[R] Write.table query

Henric Nilsson henric.nilsson at statisticon.se
Wed Mar 16 07:52:31 CET 2005


On On, 2005-03-16, 05:43, Jones, Glen R skrev:

> Hello,
>
> I have the following 'write.table' statement which works fine
>
> write.table(DataOutput,"c:/Prices.csv",append = TRUE,col.names = NA,sep
> = "," )
>
> My query is, how could I modify this so I can include a variable name as
> a prefix before the 'Prices.CSV' filename.
>
> For example:
>
> prefixname = "DevX"
>
> write.table(DataOutput,"c:/" &prefixname& "Prices.csv",append =
> TRUE,col.names = NA,sep = "," )
>
> With the resultant CSV output to be named "DevXPrices.csv".

Use `paste':

> prefixname <- "DevX"
> paste("c:/", prefixname, "Prices.csv", sep = "")
[1] "c:/DevXPrices.csv"

HTH,
Henric




More information about the R-help mailing list