Re: [R] read.zoo question

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Mon 09 Oct 2006 - 02:44:14 GMT

Try

read.zoo(myfile, sep = ",", FUN = as.POSIXct)

or

to.chron <- function(x) {

	s <- do.call(rbind, strsplit(format(x), " "))
	chron(dates(s[,1], format = "Y-M-D"), times(s[,2]))
}
read.zoo(myfile, sep = ",", FUN = to.chron)

depending on which class you want.

On 10/8/06, Leeds, Mark (IED) <Mark.Leeds@morganstanley.com> wrote:
> I have comma delimited asci data with each row being in the format :
>
> 2006-01-24 02:41:24.00011,1.22930000,5,1.22950000,7
> .
> .
> .
> .
>
> and i'm trying to use read.zoo ( which is similar to read.table ) to
> read in the data. the data goes all the way out to milliseconds and i
> can't figure out what to put for the format field. if i put nothing,
> then read.zoo gets rid of the the whole time and just keeps the date but
> i want to keep the time. i'm sure gabor knows but he may not be on so
> maybe someone else knows ? I've done ?format and ?read.zoo and i've read
> through the zoo article in the journal of statistical software but i
> can't figure it out. even if someone could point me in the right
> direction for looking ( i.e a ?whatever ) that would be a great help.
> thanks.
> --------------------------------------------------------
>
> This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation. Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers. This is not research and is not from MS Research but it may refer to a research analyst/research report. Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm. We do not represent this is accurate or complete and we may not update this. Past performance is not indicative of future returns. For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls. You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions. We cannot guarantee that any such requests received vi!
 a !
> e-mail will be processed in a timely manner. This communication is solely for the addressee(s) and may contain confidential information. We do not waive confidentiality by mistransmission. Contact me if you do not wish to receive these communications. In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules).
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon Oct 09 12:49:24 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 09 Oct 2006 - 03:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.