[R-SIG-Finance] [r-sig-finance] Package Quantmod: reading csv files

Joshua Ulrich josh.m.ulrich at gmail.com
Thu Jun 4 15:59:06 CEST 2009


Anass,

getSymbols.csv() seems to expect the data to be in the format pulled
from Yahoo.  The dimnames error is because your data is missing the
"Adjusted" column.  It also seems to force the index to class "Date",
which will not allow intra-day data.

Here's a quick work-around until Jeff can comment:
> x <- read.csv("STXE.csv")
> rownames(x) <- x[,1]; x <- x[,-1]
> y <- as.xts(x)

Best,
Josh
--
http://www.fosstrading.com



On Thu, Jun 4, 2009 at 8:16 AM, anass <anass.mouhsine at gmail.com> wrote:
> Hi all,
>
> I started to work on the package quantmod, but I have trouble reading simple
> csv files.
> The first lines of the file are as follows.
>
> Date,Open,High,Low,Close,Volume
> 2009-01-02 09:00:00,2476,2478,2468,2469,5140
> 2009-01-02 09:01:00,2469,2469,2459,2464,2998
> 2009-01-02 09:02:00,2464,2464,2459,2462,1985
> 2009-01-02 09:03:00,2462,2468,2461,2468,1694
> 2009-01-02 09:04:00,2468,2469,2466,2467,605
> 2009-01-02 09:05:00,2467,2468,2466,2468,996
> 2009-01-02 09:06:00,2468,2469,2467,2469,1241
>
> I read few days ago a thread on the subject, but it seems to me that the
> kinf of file I try to read is easier since the time is given in the first
> column.
>
> What I tried to do is the following:
>
>> t<-getSymbols('STXE',src='csv')
> Error in dimnames(x) <- dn :
>  length of 'dimnames' [2] not equal to array extent
> In addition: Warning messages:
> 1: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
> "POSIXct"),  :
>  unknown timezone ' ET'
> 2: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
> "POSIXct"),  :
>  unknown timezone ' ET'
> 3: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
> "POSIXct"),  :
>  unknown timezone ' ET'
> 4: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
> "POSIXct"),  :
>  unknown timezone ' ET'
> 5: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt",
> "POSIXct"),  :
>  unknown timezone ' ET'
>
> any thoughts on the subject?
>
> Anass
> --
>
> En toda ocasion, disfruta de la vida
>
>        [[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.
>



More information about the R-SIG-Finance mailing list