02 May 2014

#R: Installing "forecast" package

[R]Installing “forecast” package in R

[R]Installing “forecast” package in R

I was starting to learn about timeseries analysis in the class. We used several standard R functions, like:

  • acf()
  • pacf()
  • tsdiag()
  • qqnorm()

Our goal is to forecast streamflow data. To do so, we needed one of R package “forecast” written by: Rob J. Hyndman (@robjhyndman).

I ran the usual script:

install.packages(“forecast”)

but it popped an error message:

Installing package into ‘/home/dasapta/ /i686-pc-linux-gnu-library/3.0’ (as ‘lib’ is unspecified)

Warning in install.packages: package ‘forecast’ is not available (for R version 3.0.1)

Several discussions on the net suggests to update the “r-base” version to solve this. I am running Ubuntu 13.10 and these are the scripts to update it.

  1. First tell Ubuntu to get the update on Cran Repos by editing the “sources.list” file. Run this command on Terminal Window:

$ sudo gedit /etc/apt/sources.list

And add the following address at the end of the file:

deb http://cran.rstudio.com/bin/linux/ubuntu saucy/

Then “save” and “close” the file.

  1. On the terminal prompt run:

$ sudo apt-get update && sudo apt-get install r-base

Wait until the update finish, so your “R base” version will be 3.1.0 (Spring Dance). Then start “R studio” and run:

install.packages(“forecast”)

It should run to install the package and all the dependencies:

  • “Rcpp”
  • “RcppArmadillo”
  • “quadprog”
  • “fracdiff”
  • “forecast”
  • “colorspace”

Good luck. {@dasaptaerwin}

No comments: