[R-SIG-Finance] Trouble with getSymbols.csv

2012-09-17 Thread Worik Stanton

Friends

I have a file of data:

Date,Open,High,Low,Close,Volume,Adjusted
2011-12-28,1.5968,1.5987,1.5762,1.5827,0,1.58745
2011-12-29,1.5831,1.5846,1.5695,1.5724,0,1.57705
2011-12-30,1.5726,1.5877,1.5704,1.5861,0,1.57905
2011-12-31,1.585,1.5861,1.585,1.5861,0,1.58555
2012-01-01,1.585,1.5861,1.582,1.5861,0,1.58405
2012-01-02,1.5871,1.5875,1.5768,1.5802,0,1.58215
2012-01-03,1.58,1.5837,1.5726,1.5818,0,1.57815
2012-01-04,1.5819,1.5865,1.5796,1.5813,0,1.58305
2012-01-05,1.5812,1.5854,1.573,1.5795,0,1.5792
2012-01-06,1.5796,1.5871,1.5745,1.5859,0,1.5808
2012-01-07,1.5854,1.5854,1.5782,1.5782,0,1.5818
2012-01-08,1.5808,1.5866,1.5808,1.5866,0,1.5837
2012-01-09,1.5867,1.591,1.5807,1.5815,0,1.58585

When I use getSymbols(.., src=csv)

The dates are incorrect.  The first date is 2012-09-18

It seems that in getSymbols.csv uses:

as.Date(fr[, 1], format = format, ..., origin = 1970-01-01)

Looking more closely...

 as.Date(2011-12-28, origin=1970-01-01, format=)
[1] 2012-09-18

That is what I see.

But either of...
 as.Date(2011-12-28, origin=1970-01-01)
[1] 2011-12-28
 as.Date(2011-12-28)
[1] 2011-12-28


give me what I expect.

What am I doing wrong?

cheers
Worik

--
it does not matter  I think that I shall never see
how much I dig and digA billboard lovely as a tree
this hole just  Indeed, unless the billboards fall
keeps getting deeper  I'll never see a tree at all

___
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.


Re: [R-SIG-Finance] Trouble with getSymbols.csv

2012-09-17 Thread G See
This function should really have more formal arguments -- especially
the format argument.

As it is, the `format` will be set to .  You should be able to pass
`format` through the dots, but there's a syntax bug preventing that
from working (`list(...)[[format]] - NULL`).

As it is, the only way to load your data using getSymbols.csv is to
set the `format` argument in the Symbol Lookup table. (I saved the
text from your e-mail in a file at ~/tmp/worik.txt)

setSymbolLookup(worik=list(src='csv', format='%Y-%m-%d'))
getSymbols('worik', dir='~/tmp', auto.assign=FALSE, extension='txt')

   WORIK.Open WORIK.High WORIK.Low WORIK.Close WORIK.Volume
2011-12-28 1.5968 1.59871.5762  1.58270
2011-12-29 1.5831 1.58461.5695  1.57240
2011-12-30 1.5726 1.58771.5704  1.58610
2011-12-31 1.5850 1.58611.5850  1.58610
2012-01-01 1.5850 1.58611.5820  1.58610
2012-01-02 1.5871 1.58751.5768  1.58020
2012-01-03 1.5800 1.58371.5726  1.58180
2012-01-04 1.5819 1.58651.5796  1.58130
2012-01-05 1.5812 1.58541.5730  1.57950
2012-01-06 1.5796 1.58711.5745  1.58590
2012-01-07 1.5854 1.58541.5782  1.57820
2012-01-08 1.5808 1.58661.5808  1.58660
2012-01-09 1.5867 1.59101.5807  1.58150
   WORIK.Adjusted
2011-12-281.58745
2011-12-291.57705
2011-12-301.57905
2011-12-311.58555
2012-01-011.58405
2012-01-021.58215
2012-01-031.57815
2012-01-041.58305
2012-01-051.57920
2012-01-061.58080
2012-01-071.58180
2012-01-081.58370
2012-01-091.58585

HTH,
Garrett

On Mon, Sep 17, 2012 at 4:12 PM, Worik Stanton worik.stan...@gmail.com wrote:
 Friends

 I have a file of data:

 Date,Open,High,Low,Close,Volume,Adjusted
 2011-12-28,1.5968,1.5987,1.5762,1.5827,0,1.58745
 2011-12-29,1.5831,1.5846,1.5695,1.5724,0,1.57705
 2011-12-30,1.5726,1.5877,1.5704,1.5861,0,1.57905
 2011-12-31,1.585,1.5861,1.585,1.5861,0,1.58555
 2012-01-01,1.585,1.5861,1.582,1.5861,0,1.58405
 2012-01-02,1.5871,1.5875,1.5768,1.5802,0,1.58215
 2012-01-03,1.58,1.5837,1.5726,1.5818,0,1.57815
 2012-01-04,1.5819,1.5865,1.5796,1.5813,0,1.58305
 2012-01-05,1.5812,1.5854,1.573,1.5795,0,1.5792
 2012-01-06,1.5796,1.5871,1.5745,1.5859,0,1.5808
 2012-01-07,1.5854,1.5854,1.5782,1.5782,0,1.5818
 2012-01-08,1.5808,1.5866,1.5808,1.5866,0,1.5837
 2012-01-09,1.5867,1.591,1.5807,1.5815,0,1.58585

 When I use getSymbols(.., src=csv)

 The dates are incorrect.  The first date is 2012-09-18

 It seems that in getSymbols.csv uses:

 as.Date(fr[, 1], format = format, ..., origin = 1970-01-01)

 Looking more closely...

 as.Date(2011-12-28, origin=1970-01-01, format=)
 [1] 2012-09-18

 That is what I see.

 But either of...
 as.Date(2011-12-28, origin=1970-01-01)
 [1] 2011-12-28
 as.Date(2011-12-28)
 [1] 2011-12-28


 give me what I expect.

 What am I doing wrong?

 cheers
 Worik

 --
 it does not matter  I think that I shall never see
 how much I dig and digA billboard lovely as a tree
 this hole just  Indeed, unless the billboards fall
 keeps getting deeper  I'll never see a tree at all

 ___
 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.