J'ai une XTS qui ressemble à ceci:Comment garder Index/dates lors du passage de XTS à matrice en R
EUR.CLOSE EUR.CLOSE.1 EMA RUB.CLOSE RUB.CLOSE.1 EMA.1 COP.CLOSE COP.CLOSE.1 EMA.2 MXN.CLOSE
2016-08-30 -0.7176776 0.1507033 42.50321 0.6565255 0.1969145 52.73467 0.4499486 -1.517971 47.0703 1.618209
MXN.CLOSE.1 EMA.3 INR.CLOSE INR.CLOSE.1 EMA.4 KRW.CLOSE KRW.CLOSE.1 EMA.5 PHP.CLOSE PHP.CLOSE.1
2016-08-30 0.6377586 59.46614 0.06742503 0.04767418 51.04673 0.7059685 -0.02246669 52.88059 -0.06188119 -0.7181662
EMA.6
2016-08-30 45.22928
> nt[,1]
dput ici:
structure(c(-0.717677627452784, 0.150703341994461, 42.5032053202923,
0.656525491646624, 0.196914493557725, 52.7346708652452, 0.44994857730542,
-1.51797051765522, 47.0703023915683, 1.61820941470502, 0.637758577228606,
59.4661365407602, 0.0674250335669636, 0.0476741757424079, 51.0467264878632,
0.705968496624654, -0.0224666928598931, 52.8805945280585, -0.0618811881188627,
-0.718166164442612, 45.2292753580903), .Dim = c(1L, 21L), .Dimnames = list(
NULL, c("EUR.CLOSE", "EUR.CLOSE.1", "EMA", "RUB.CLOSE", "RUB.CLOSE.1",
"EMA.1", "COP.CLOSE", "COP.CLOSE.1", "EMA.2", "MXN.CLOSE",
"MXN.CLOSE.1", "EMA.3", "INR.CLOSE", "INR.CLOSE.1", "EMA.4",
"KRW.CLOSE", "KRW.CLOSE.1", "EMA.5", "PHP.CLOSE", "PHP.CLOSE.1",
"EMA.6")), index = structure(1472533200, tzone = "", tclass = c("POSIXct",
"POSIXt")), .indexTZ = "", class = c("xts", "zoo"), .indexCLASS = c("POSIXct",
"POSIXt"), tclass = c("POSIXct", "POSIXt"), tzone = "")
Et je veux convertir à:
Dates % dev from 20MA % dev from 20MA RSI
2016-08-30 EUR -0.71767763 0.15070334 42.50321
2016-08-30 RUB 0.65652549 0.19691449 52.73467
2016-08-30 COP 0.44994858 -1.51797052 47.07030
2016-08-30 MXN 1.61820941 0.63775858 59.46614
2016-08-30 INR 0.06742503 0.04767418 51.04673
2016-08-30 KRW 0.70596850 -0.02246669 52.88059
2016-08-30 PHP -0.06188119 -0.71816616 45.22928
J'ai essayé le code suivant:
out.trend <- matrix(new.trend(MergedData), ncol = 3, byrow = TRUE,
dimnames = list(paste0(cursig), c("% dev from 20MA", "% dev from 20MA", "RSI")))
Mais cela donne la matrice ci-dessus sans les dates. Y at-il de toute façon que je peux ajouter les dates de mon vecteur xts?
Comment est un R/XTS se demander une copie exacte d'une question bash? –