[R-SIG-Finance] [R-sig-finance] Date from csv as date for ts

Jeff Ryan jeff.a.ryan at gmail.com
Tue May 6 17:36:30 CEST 2008


Take a look at the 'zoo' or 'xts' packages:

xts(smallcap.ts[,-1],as.Date(smallcap.ts[,1]))

zoo(smallcap.ts[,-1],as.Date(smallcap.ts[,1]))

'xts' extends zoo - so you get all the goodness of zoo, and it adds some
time-specific functionality.

Either would be a good choice/start.

A working sample might let me provide a more direct answer.

Jeff

On Tue, May 6, 2008 at 10:17 AM, R at Nabble <vlanschot at yahoo.com> wrote:
>
>  Apologies if this has been answered elsewhere, but I couldn't find it.
>
>  Basically, I dump securities' return- data in a csv-file with 3 columns:
>  Name, Date, and Returns. In other words, the Date column contains multiple
>  entries for each date, namely one for each security. I figured out how to
>  extract these dates in one vector with strings from "31/01/2000" to
>  31/03/2008", which I then transformed via the as.Date function. I
>  subsequently created a return-matrix via cbind for each security.
>
>  My question/problem is, I have been unable to use the date-vector as
>  date-input for my ts-object. Looking at the smallcap.ts-example on page 14
>  of the fPortfolio Package pdf, I'd like to somehow combine my Date-vector
>  with my return-matrix into one large matrix for input in fPortfolio. Using
>  cbind, etc. leads to errors.
>
>  Clearly I'm on a steep learning curve, so any help appreciated.
>
>  Thx,
>
>  R at N
>  --
>  View this message in context: http://www.nabble.com/Date-from-csv-as-date-for-ts-tp17085476p17085476.html
>  Sent from the Rmetrics mailing list archive at Nabble.com.
>
>  _______________________________________________
>  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.
>



-- 
There's a way to do it better - find it.
Thomas A. Edison



More information about the R-SIG-Finance mailing list