Thanks Stephen.

I found this in the archives...

*Sat, 21 Aug 2010 05:35:11 -0700
*getSymbols() returns an xts object (which is a subclass of zoo) by

*default.  The dates in xts/zoo objects are stored in an "index"
attribute that is unique to xts/zoo objects, so write.table() doesn't
know to write this attribute to the file.

So you need to:
1) Give write.table() the rownames to use via:
write.table(IBM, file = "ibm-data.txt", row.names=index(IBM))
2) Or (my preference) use write.zoo():
write.zoo(IBM, file = "ibm-data.txt")

HTH,
--
Joshua Ulrich
FOSS Trading: www.fosstrading.com



On Sat, Aug 21, 2010 at 5:58 AM, Werner Erselina <w.ersel...@gmail.com> wrote:
> Hi fellow R users,
>
> As a new user to r and quantmod i have the following problem. Using quantmod
> for retrieving data from yahoo or google i am stuck in writing this data to
> a text file.
>
>> getSymbols("IBM")
> [1] "IBM"
>> write.table(IBM, file = "ibm-data.txt")
>
> The text file created this way does not contain the date information.
>
> So how could i best write quantmod data to a text file?
>
> greetings,
>
> Werner
>*



On Thu, Nov 18, 2010 at 5:35 PM, Stephen Choularton <
stephen@organicfoodmarkets.com.au> wrote:

> A simple way, if the data is not to large, is simply to select it with the
> mouse, copy it and then past it into an open office or microsoft
> spreadsheet.  The dates you are reading, which I think are produced from
> some original start date associated with the object plus some periodicity
> for each line, are simply picked up as what they look like.
>
> If it is to large I don't know the ideal way.  I guess there must be some
> option to get the  but I guess I would  do something like this:
>
> If you do something like this:
>
> write.table(data, 'c:/rdata/test/a.csv',sep=',')
>
> you get it into a table with numbers where the dates should be and then
> play with the options.  Maybe if you add row.name= TRUE it will give you
> the dates.
>
> Stephen Choularton Ph.D., FIoD
>
>
> On 19/11/2010 8:01 AM, Jason Kwok wrote:
>
>> Hi,
>>
>> I've used Quantmod to download some data into R and I want to export it
>> into
>> a CSV file.  The problem is that data gets exported without the date
>> column
>> and it looks like below.
>>
>>  1 4.06  2 4.03  3 3.99  4 4.02  5 4.03  6 4.05  7 4.07  8 4.08  9 4.08
>> How do I get the data exported with the corresponding date attached?
>>
>> Thanks,
>>
>> Jason
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-SIG-Finance@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.
>> -- Also note that this is not the r-help list where general R questions
>> should go.
>>
>>
>>
>>
>> -----
>> No virus found in this message.
>> Checked by AVG - www.avg.com
>> Version: 10.0.1153 / Virus Database: 424/3263 - Release Date: 11/17/10
>>
>>
>>

	[[alternative HTML version deleted]]

