【问题标题】:RParsingError: error when running quantmod library in ipynb notebookRParsingError:在 ipynb 笔记本中运行 quantmod 库时出错
【发布时间】:2021-10-07 04:26:23
【问题描述】:
我在 Google Colab 笔记本的 ipynb 中运行 R 代码。但是,代码中有RParsingError。但是,如果我将0200.KL 替换为AAPL,则效果很好。
%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
有什么办法解决吗?
【问题讨论】:
标签:
r
ipython
google-colaboratory
quantmod
parsing-error
【解决方案1】:
已解决,下面是代码。
%%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")