[R] Time and xts
rnick
nikos.rachmanis at gmail.com
Sun Jan 16 05:20:39 CET 2011
Hi all,
I have run into a problem and some help would be highly appreciated.
I have a .csv with the following columns:
Date Time Open High Low Close
1/2/2005 17:05 1.3546 1.3553 1.3546 1.35495
1/2/2005 17:10 1.3553 1.3556 1.3549 1.35525
1/2/2005 17:15 1.3556 1.35565 1.35515 1.3553
1/2/2005 17:25 1.355 1.3556 1.355 1.3555
….
…..
2/13/2006 5:20 1.18895 1.18925 1.18835 1.1885
1) Without using zoo, xts or any other time series object, I am trying to
run this code but fails to pass the argument to the function
#n is the length of the series
for (t in seq(from=10,to=n,by=1))
{
while (time[t]=='02:00:00')
{
entrytrade(t)
}
}
Is this possible to do? If yes, any ideas what I am doing wrong?
2) I have also tried with xts by creating the object like this
lines<-data.frame(date,time,open,high,low,close)
z <- read.zoo(lines, header = TRUE, index = list(1, 2), FUN = function(d,t)
as.POSIXct(paste(date,time), format = "%m/%d/%Y %H:%M"))
x<-as.xts(z)
However, I am unable to call just the time and run the above for loop. any
ideas here?
Thanks
--
View this message in context: http://r.789695.n4.nabble.com/Time-and-xts-tp3219722p3219722.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list