[R-SIG-Finance] How to format a CSV file output ?

pierre8r-gmane at yahoo.fr pierre8r-gmane at yahoo.fr
Wed Jul 16 15:40:19 CEST 2008


Hello,

Here my R code :

library(xts)
library(quantmod)

quotes <- read.csv2("E:\\00001-Compare\\Output\\OutputJBacktesting\\InputIndic.txt",
header = FALSE, sep = ",", dec=".")

x <- xts(as.matrix(quotes[,-1]),as.POSIXct(paste(quotes[,1]),format='%m/%d/%Y
%H:%M'))
colnames(x) <- c('Indic')
x

write.csv(x, file = "OutputIndic.csv", quote = FALSE, row.names = FALSE)
                                   
The x give this output to the R Console :

> colnames(x) <- c('Indic')
> x
                      Indic
2007-01-08 00:59:00 1.93025
2007-01-08 01:59:00 1.92960
2007-01-08 02:59:00 1.92805


My goal is to generate this kind of CSV output :

01/08/2007,00:59, 1.93025 
01/08/2007,01:59, 1.92955 
01/08/2007,02:59, 1.92885 

My write.csv generate this CSV output :

Indic
1.93025
1.9296
1.92805

How to generate this kind of output ?

01/08/2007,00:59, 1.93025 
01/08/2007,01:59, 1.92955 

Thanks,

Pierre8r


      ____________________________________________________
intelligente http://mail.yahoo.fr



More information about the R-SIG-Finance mailing list