I have this sample in R
require("quantmod") ;
getSymbols(c("AUD=X","GBP=X","JPY=X")) ;
ccyportfolio <- merge(`AUD=X`[,4], `GBP=X`[,4], `JPY=X`[,4]) * c(50e+6, 50e+6, -80e+6) ;
But the results are
AUD.X.Close GBP.X.Close JPY.X.Close
2007-01-01 63000000 -40800000 5944000000
2007-01-02 63000000 25500000 -9506400000
2007-01-03 -100800000 25500000 5967000000
2007-01-04 64000000 -40800000 5941500000
2007-01-05 64000000 26000000 -9495200000
2007-01-08 -102400000 26000000 5934500000
But I would expect the correct result to be this but don't understand why xts cannot multiply by a vector directly.
AUD.X.Close GBP.X.Close JPY.X.Close
2007-01-01 63000000 25500000 -9510400000
2007-01-02 63000000 25500000 -9506400000
2007-01-03 63000000 25500000 -9547200000
2007-01-04 64000000 25500000 -9506400000
2007-01-05 64000000 26000000 -9495200000
2007-01-08 64000000 26000000 -9495200000