Unable to access/install xts package

Rahul picture Rahul · May 22, 2016 · Viewed 9.5k times · Source

I am unable to install xts package on R version 3.3.0 on my macbook. I am getting following error:

install.packages("xts", repos="http://R-Forge.R-project.org")

Warning: unable to access index for repository http://R-Forge.R-project.org/bin/macosx/mavericks/contrib/3.3: cannot open URL 'http://R-Forge.R-project.org/bin/macosx/mavericks/contrib/3.3/PACKAGES'

Warning message: package ‘xts’ is not available (for R version 3.3.0)

I also tried installing through "Package Installer" and it seems to have installed with no error/warning. However when I tried following:

xts(rnorm(231),as.Date(13514:13744,origin="1970-01-01"))

Error: could not find function "xts"

Any help is much appreciated.

Answer

Dirk Eddelbuettel picture Dirk Eddelbuettel · May 22, 2016

Why don't you try the CRAN version instead?

Just use

install.packages("xts", repos="http://cloud.r-project.org")

which should install just fine. R-Forge is primarily a source repository so download and installation is not the primary use case and may be less stringently tested.

Edit: As as the OP appears to be posting simultaneously to the R-Forge lists (hint: don't do that; pick one venue and post just there) here is how you use it once installed:

R> library(xts)   # you need to load it
Loading required package: zoo

Attaching package: ‘zoo’

The following objects are masked from ‘package:base’:

    as.Date, as.Date.numeric

R> xts(1:5, Sys.Date()+0:4)
           [,1]
2016-05-22    1
2016-05-23    2
2016-05-24    3
2016-05-25    4
2016-05-26    5
R>