RParsingError: error when running quantmod library in ipynb notebook

344 Views Asked by At

I am running R code in ipynb of the Google Colab notebook. However, there is RParsingError for the code. But, if I replace 0200.KL with AAPL, it works well.

%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

However, the error shows as below:

RParsingError: Parsing status not OK - PARSING_STATUS.PARSE_ERROR

Any ways to solve it?

1

There are 1 best solutions below

0
TAN YONG SHENG On

SOLVED, below is the code.

%%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")