0

I have an XTS with this structure:

            Variable1  Variable2  Variable3
2014-06-23          2          1          3

The values for these variables are ranks. I've ranked them all for some parameter and want to show these ranks in a tabular way and show the past ranks for these variables as well. So in the end the output should look like this:

           2014-06-23   Rank3WeeksAgo Rank6WeeksAgo
Variable2           1               1             2
Variable1           2               3             1
Variable3           3               2             3

So I basically need the original XTS to be sorted ascending and then add the necessary columns myself. However I'm not able to correctly sort this XTS.

How can I do this?

My current code to get the transposed view:

OriginalXTS
Transposed<-t(OriginalXTS)

Transposed is now anyway a Matrix and the Variable names are now like the index for a row, however I cannot access them. So I'm struggling here anyway.

Thomas
  • 43,637
  • 12
  • 109
  • 140
MichiZH
  • 5,587
  • 12
  • 41
  • 81

0 Answers0