1
library(quantmod)
getSymbols('AAPL')
n <- nrow(AAPL)
a <- runif(n)

I would like to convert a to an xts object with dates equal to the dates of AAPL.

So far I wasn't able to do it by any way.

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418

1 Answers1

2

This is very simple:

a <- xts(runif(nrow(AAPL)), index(AAPL))
Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418