0

我在 Google Colab 笔记本的 ipynb 中运行 R 代码。但是,有RParsingError代码。但是,如果我替换0200.KLAAPL,效果很好。

%load_ext rpy2.ipython

%%R
library(quantmod)
library(xts)
library(PerformanceAnalytics)
library(rugarch)

getSymbols(Symbols="0200.KL",src="yahoo",from="2020-1-1",to="2021-1-1")
0200.KL

但是,错误显示如下:

RParsingError:解析状态不正常 - PARSING_STATUS.PARSE_ERROR

有什么办法可以解决吗?

4

1 回答 1

0

已解决,下面是代码。

%%R
library(quantmod)
library(xts)
library(PerformanceAnalytics)
library(rugarch)

getSymbols(Symbols="0200.KL",src="yahoo",from="2016-1-1",to="2021-1-1") # function under quantmod library

REV = `0200.KL`
# remove the original dataframe from your workspace
rm(`0200.KL`)

#change column names
colnames(REV) = c("Open","High","Low","Close","Volume","Adjusted Close")

chartSeries(REV["2020-12"]) # under quantmod, plot dec 2020 ohlc data
chartSeries(REV$Close, theme="white")
于 2021-08-06T13:20:29.937 回答