An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20090925/6676c492/attachment.pl>
write.xts() and read.xts()
6 messages · Gabor Grothendieck, Brian G. Peterson, Jeff Ryan +1 more
Try: x <- as.xts(read.zoo(...)) write.zoo(as.zoo(x), ...)
On Fri, Sep 25, 2009 at 10:49 AM, Wind <windspeedo99 at gmail.com> wrote:
There are write.zoo() and read.zoo() in the zoo package. ? But there are no write.xts() or read.xts() in the xts package.Since xts is so powerful manipulating historic prices, I wonder how do you save those xts. ? Write your own function like write.zoo for xts? ? Or just use write.zoo and read.zoo and convert to xts again? ?It seems that the attributes of xts ?could not be maintained in the zoo-like way. Thanks. Wind ? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
Wind wrote:
There are write.zoo() and read.zoo() in the zoo package. But there are no write.xts() or read.xts() in the xts package.Since xts is so powerful manipulating historic prices, I wonder how do you save those xts. Write your own function like write.zoo for xts? Or just use write.zoo and read.zoo and convert to xts again? It seems that the attributes of xts could not be maintained in the zoo-like way
I typically use read.zoo to read CSV or similar data into R. This is then trivially converted to xts. Once in R, I typically save my data of all types as binary .Rdata files using "save". I only write data to CSV files using write.csv, write.table, or write.zoo when I need to export it for use by others. The binary formats are much faster to load and use than constantly converting back and forth from text. Regards, - Brian
Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock
The one issue with text based storage is that attributes are difficult to handle. As attributes on xts objects (any objects) can be any legal R object, it requires some form of serialization to record as text. This is doable with dput. Aside from Gabor's suggestion, the only way to save everything in an xts object is to save it in binary form via save/.saveRDS. This should be portable and fast, though not obviously in text/human-readable form. That said, I'll add write.xts and read.xts at some point in the near future. Thanks, Jeff On Fri, Sep 25, 2009 at 9:54 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
Try: x <- as.xts(read.zoo(...)) write.zoo(as.zoo(x), ...) On Fri, Sep 25, 2009 at 10:49 AM, Wind <windspeedo99 at gmail.com> wrote:
There are write.zoo() and read.zoo() in the zoo package. ? But there are no write.xts() or read.xts() in the xts package.Since xts is so powerful manipulating historic prices, I wonder how do you save those xts. ? Write your own function like write.zoo for xts? ? Or just use write.zoo and read.zoo and convert to xts again? ?It seems that the attributes of xts ?could not be maintained in the zoo-like way. Thanks. Wind ? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
Jeffrey Ryan jeffrey.ryan at insightalgo.com ia: insight algorithmics www.insightalgo.com
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20090925/59423334/attachment.pl>
xts is always under development, and one major component is the integration with on-disk persistent storage. This will allow for many xts operations to be directly available to disk-based data. That said, it is a solid 6 months away from production code. I'll of course keep the list posted to any developments that might be of interest. The svn logs on R-forge are also a good way to see what is happening with the package. If anyone would like to alpha/beta test the on-disk xts code, please send me an email off list. Thanks, Jeff
On Fri, Sep 25, 2009 at 10:33 AM, Wind <windspeedo99 at gmail.com> wrote:
So it seems that I should use different method for different scale of data: hundreds of millions of rows, ?kdb+ , column based database; equal to or less than millions of rows, save and xts, binary file; even less rows, xts and save.zoo, text file. If write.xts could write data as binary files as well as text files, it would be fantastic. Thanks for all. Wind On Fri, Sep 25, 2009 at 10:59 PM, Jeff Ryan <jeff.a.ryan at gmail.com> wrote:
The one issue with text based storage is that attributes are difficult to handle. ?As attributes on xts objects (any objects) can be any legal R object, it requires some form of serialization to record as text. This is doable with dput. ?Aside from Gabor's suggestion, the only way to save everything in an xts object is to save it in binary form via save/.saveRDS. ?This should be portable and fast, though not obviously in text/human-readable form. That said, I'll add write.xts and read.xts at some point in the near future. Thanks, Jeff On Fri, Sep 25, 2009 at 9:54 AM, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
Try: x <- as.xts(read.zoo(...)) write.zoo(as.zoo(x), ...) On Fri, Sep 25, 2009 at 10:49 AM, Wind <windspeedo99 at gmail.com> wrote:
There are write.zoo() and read.zoo() in the zoo package. ? But there are no write.xts() or read.xts() in the xts package.Since xts is so powerful manipulating historic prices, I wonder how do you save those xts. Write your own function like write.zoo for xts? ? Or just use write.zoo and read.zoo and convert to xts again? ?It seems that the attributes of xts ?could not be maintained in the zoo-like way. Thanks. Wind ? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
-- Jeffrey Ryan jeffrey.ryan at insightalgo.com ia: insight algorithmics www.insightalgo.com
Jeffrey Ryan jeffrey.ryan at insightalgo.com ia: insight algorithmics www.insightalgo.com