Dear all,
I was hoping someone could help me to generate an index based on data
in zooreg format. The data are of the form
> head(dq)
sphsxs eunrfi irhont
1995(1) 670.8 82.9 NA
1995(2) 686.0 82.9 NA
1995(3) 682.6 83.0 NA
1995(4) 692.7 82.7 NA
1996(1) 686.0 81.5 33.6
1996(2) 697.8 82.0 34.6
and I would like to index each of the three variables to 100 in
1996(1). I have made a few failed attempts based on extracting the
values at that date
> dq[index(dq)==1996.00]
sphsxs eunrfi irhont
1996(1) 686 81.5 33.6
and then trying to divide the series by those values
> dq/dq[index(dq)==1996.00]
sphsxs eunrfi irhont
1996 1 1 1
but this results in a single row. One option might be to replicate the
1996 row using rep, but
> rep(dq[index(dq)==1996.00],2)
[1] 686.0 81.5 33.6 686.0 81.5 33.6
seems to repeat the data within a single vector, and I'm not sure how
to get it to repeat the row down through a zoo object (and suspect
there might be an easier way).
Any help much appreciated.
thanks
Aidan
_______________________________________________
[email protected] 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.