user1620355
user1620355

Reputation: 13

How to convert an array to xts

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.

Upvotes: 1

Views: 397

Answers (1)

Joshua Ulrich
Joshua Ulrich

Reputation: 176648

This is very simple:

a <- xts(runif(nrow(AAPL)), index(AAPL))

Upvotes: 2

Related Questions