Many thanks.



On 17 September 2012 22:19, Joshua Ulrich <josh.m.ulrich@gmail.com> wrote:

> On Mon, Sep 17, 2012 at 2:15 PM, Dave <miniflowtrader@gmail.com> wrote:
> > You will find that using fasttime will make a huge difference in load
> times
> > if you are not happy with performance.
> >
> > parseTickData <- function(inputFile) {
> >   DAT.list <- scan(file=inputFile,
> > sep=",",skip=1,what=list(Date="",Time="",Close=0,Volume=0),quiet=T)
> >   index <- fastPOSIXct(paste(DAT.list$Date,DAT.list$Time),"GMT")
> >   DAT.xts <-
> > xts(data.frame(Close=DAT.list$Close,Volume=DAT.list$Volume),index)
> >   DAT.xts <- make.index.unique(DAT.xts)
> >   return(DAT.xts)
> > }
> >
> > Your data must be in the format:
> >
> > 2012-03-23,03:00:00
> >
> It also must be in GMT, i.e. no daylight saving time.
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
>
>
> > -----Original Message-----
> > From: r-sig-finance-bounces@r-project.org
> > [mailto:r-sig-finance-bounces@r-project.org] On Behalf Of Costas Vorlow
> > Sent: Monday, September 17, 2012 2:14 PM
> > To: r-sig-finance@r-project.org
> > Subject: [R-SIG-Finance] Problems with time format and read.csv()
> >
> > Hello,
> >
> > Following a previous post,
> > http://www.mail-archive.com/r-sig-finance@r-project.org/msg03727.html
> >
> > I am having trouble with the hours format as it is picked up by the
> > read.csv() command.
> >
> > The following data:
> >
> > "Date","Time","Open","High","Low","Close","Up","Down"
> > 04/27/2012,0930,12.24,12.24,12.24,12.24,0,300
> > 04/27/2012,0930,12.24,12.24,12.24,12.24,0,200
> >
> > are read as
> >
> > datain<-read.csv('tick.csv', header=TRUE)
> >
> >> head(dat)
> >         Date Time  Open  High   Low Close  Up Down
> > 1 04/27/2012  930 12.24 12.24 12.24 12.24   0  300
> > 2 04/27/2012  930 12.24 12.24 12.24 12.24   0  200
> >
> >
> > i.e., 0930 becomes 930. How can this be translated to a "proper" time
> i.e,
> > 9:30 so I can convert the data frame to an XTS object accordingly?
> >
> > I try to fix it by using  %k below instead of %H  (which also didn't
> work)
> >
> > hf<-xts(dat[,6], as.POSIXct(paste(dat[,1], dat[,2]),  format = "%m/%d/%Y
> > %k%M"))
> >
> > but I get NAs
> >
> >> head(hf)
> >       [,1]
> > <NA> 12.24
> > <NA> 12.24
> > <NA> 12.25
> > <NA> 12.25
> > <NA> 12.25
> > <NA> 12.25
> >
> > using %I in the format= above also didn't work. I gather that this is
> not a
> > timezone problem and has to do with the way the time format is
> understood by
> > R when generating a  time index for the XTS object.
> >
> > Thanks in advance for your time and answers, Costas
> > --
> >
> >         [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-SIG-Finance@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> > -- Subscriber-posting only. If you want to post, subscribe first.
> > -- Also note that this is not the r-help list where general R questions
> > should go.
> >
> > _______________________________________________
> > R-SIG-Finance@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> > -- Subscriber-posting only. If you want to post, subscribe first.
> > -- Also note that this is not the r-help list where general R questions
> should go.
>



-- 

__________________________________________________________________
*Costas Vorlow *
*http://www.linkedin.com/in/costasvorlow*
*http://www.vorlow.com* <http://www.vorlow.com>
*
*

	[[alternative HTML version deleted]]

