[R] reading data using XTS package
Upananda Pani
upananda.pani at gmail.com
Wed Nov 19 04:42:29 CET 2014
Dear All,
I want to read the my time series data using XTS package and then to
calculate return using PeformanceAnalytics Package but i am getting the
following error. Please help me to solve the problem. The error follows:
# Required Libraries
> library(xts)
> library(PerformanceAnalytics)
>
> #Reading Data
> x<-read.csv('crude.csv')
> y<-xts(x[,1:2],as.numeric(x[,2:2]),order.by
=as.Date(x[,1],format='%d-%b-%y'))
> close <- y$close
>
> #Calculating Return
> rspot = Return.calculate(close, method = c ("discrete"))
Error in `/.default`(pr, lag(pr)) :
non-numeric argument to binary operator
I am not getting where i am committing the mistake.
With sincere regards,
Upananda
--
You may delay, but time will not.
Research Scholar
alternative mail id: upani at iitkgp.ac.in
Department of HSS, IIT KGP
KGP
More information about the R-help
mailing list