AlphaVantager时间序列集YYYY MM DD HH MM SS

AlphaVantager时间序列集YYYY MM DD HH MM SS,r,time-series,quantmod,R,Time Series,Quantmod,我使用R中的alphavantager软件包下载了数据。我正在尝试将分钟数据设置为时间序列xts对象 rm(list = ls()) library(alphavantager) AlphaKey <- av_api_key("YOUR API Key (Free) - (obtainable here: https://www.alphavantage.co/support/#api-key) ") print(AlphaKey) args(av_get) GOOG <-

我使用R中的
alphavantager
软件包下载了数据。我正在尝试将分钟数据设置为时间序列
xts
对象

rm(list = ls())

library(alphavantager)

AlphaKey <- av_api_key("YOUR API Key (Free) - (obtainable here: https://www.alphavantage.co/support/#api-key)  ")
print(AlphaKey)

args(av_get)

GOOG <- av_get(symbol = "GOOG", av_fun = "TIME_SERIES_INTRADAY", interval = "1min", outputsize = "full")
plot(GOOG$close)   

close_price <- GOOG$close

times <- as.POSIXct(GOOG$timestamp, format="%d/%m/%Y %H:%M")
times
times <-format(GOOG$timestamp, format="%H:%M:%S")
df <- cbind(times, close_price)
我怎样才能在R里做这件事

编辑:我从
chartSeries
函数中得到的错误:

chartSeries(df, TA=NULL)

> Error in try.xts(x, error = "chartSeries requires an xtsible object") : 
  chartSeries requires an xtsible object

quantmod
不同,
alphavantager
不会将数据转换为
xts
对象。因此,你必须自己做。这应该起作用:

df <- xts(GOOG[,-1], order.by = as.POSIXct(GOOG$timestamp))
df
df <- xts(GOOG[,-1], order.by = as.POSIXct(GOOG$timestamp))