Skip to content
Prev 11393 / 15274 Next

use rows and cols of a matrix as dates

On Thu, Mar 14, 2013 at 10:05 AM, Sven D <sduve at hotmail.com> wrote:
Thanks for including context even though you're posting via Nabble.

No need to do all the conversions.  Your matrix is symmetric, which
means you can use the index values when you want to reference the
column "Dates".

indexDate <- as.Date(index(gy))
(indexDate[2]-indexDate[1])/365
c(indexDate[2]-indexDate[1])/365  # not a difftime object
Best,
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

R/Finance 2013: Applied Finance with R  | www.RinFinance.com