Skip to content

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:
#
Wind wrote:
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
#
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:

  
    
#
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: