[R-SIG-Finance] reading forex data zoo or xts?
Gabor Grothendieck
ggrothendieck at gmail.com
Sat Sep 4 17:02:26 CEST 2010
On Sat, Sep 4, 2010 at 10:49 AM, Andres Susrud <andres.susrud at gmail.com> wrote:
> Hi,
>
> I'm having some problems reading a time series data set with 2 columns of
> time.
> The dataset consist of the following columns:
> "Date","Time","Open","High","Low","Close","TotalVolume"
>
> which would be desirable, easiest for handling the dataset, xts? or zoo?
>
> any suggestions for the read command as well?
>
read.zoo can read date and time in two columns by specifying a vector
or list to index. Be sure you have the latest version of zoo since
this is a feature that was added in recent versions of the package.
Lines <- "Date Time Value
01/23/2000 10:12:15 12.12
01/24/2000 11:10:00 15.00"
library(zoo)
library(chron)
z <- read.zoo(textConnection(Lines), header = TRUE,
index = list(1, 2), FUN = chron)
read.zoo can read input data with two columns for time.
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-SIG-Finance
mailing list