Installing package (“forecast”) in R

I already have RHive installed, then for the next step, I woul like try to install forecast package of R. This is my share thought while installing forecast package in R

1. Open R shell

$ sudo R

2. In the R shell, install forecast package

> install.packages(“forecast”)

while installing forecast package, in the console will print this following information

” also installing the dependencies ‘quadprog’, ‘tseries’, ‘fracdiff’, ‘RcppArmadillo’ ”

However, i found some problem, for example

  • Cannot find /Install Rcpp
    Solution : install packages Rcpp inside R shell  : > install.packages(“Rcpp”)
  • Cannot find some compiler

    /usr/bin/ld: cannot find -llapack
    /usr/bin/ld: cannot find -lblas

  • Cannot install RcppArmadillo
    Solution : install packages RcppArmadillo inside R shell –> install.packages(“RcppArmadillo”)
  • RcppArmadillo cannot be installed
    solution : try to install this package : $ sudo apt-get install r-base-dev , then once again try to install RcppArmadillo inside R shell

This following step will be the best practice for installing packages (“forecast”) in R (version 3.0.2)

  1. Install / re install specific version of R
  2. Install this following packages, by following these step
  • Go to R shell
  • $ sudo R
  • > install.packages(“Rcpp”)
  • > install.packages(“RcppArmadillo”)
  • > install.packages(“quadprog”)
  • > install.packages(“fracdiff”)
  • > install.packages(“forecast”)

Note : when installing package forecast also installing the dependencies ‘quadprog’, ‘tseries’, ‘fracdiff’, ‘RcppArmadillo’

Advertisements

Connecting R with Hive (RHive)

Previously, you have to install Rhive package in R, you can follow this post

Running RHive

In the R Console

> library(RHive)
> Sys.setenv(HIVE_HOME=”/usr/local/hive”)
> Sys.setenv(HADOOP_HOME=”/usr/local/hadoop”)
> rhive.init()
> rhive.connect(“ipaddress of hive server”)

example

> rhive.connect(“localhost”)
> rhive.connect(“164.125.50.12

or

> rhiveConnection<-rhive.connect(“ipaddress of hive server”)
> rhive.init()

try hive query in rhive

> rhive.query(“<hiveQL-query>”)

ex

> rhive.query(“show databases”)

close connection

> rhive.close()

Installing RHive in Ubuntu 12.04

I install RHive using this environment :

  1. OS : Ubuntu 12.04
  2. Java : 1.7. update 21
  3. Hadoop : 1.3
  4. Hive : 0.11.0
  5. R : 3.0.2

installing r
source : http://craig-russell.co.uk/2012/05/08/install-r-on-ubuntu.html#.Ub6yY3UW0ak

list of r mirror : http://cran.r-project.org/mirrors.html

pre-installation

1. type these command in terminal
$ gpg –keyserver keyserver.ubuntu.com –recv-key E084DAB9
$ gpg -a –export E084DAB9 | sudo apt-key add –

2. edit sources.list (/etc/apt/sources.list) and add this following line
deb http://cran.ma.imperial.ac.uk/bin/linux/ubuntu precise/

3. install r
$ sudo apt-get update
$ sudo apt-get install r-base

5. Installing rJava
– installing from aptitude
$ sudo apt-get install r-cran-rjava

6. installing rserver
– installing from aptitude
$ sudo apt-get install r-cran-rserve

7. Add package RHive in R
– run R
$ R (or alternative : $ sudo R)
>
– in R shell, install RHive package, by run these
> install.packages(“rJava”)
> install.packages (“RHive”)

Alternative (simple step):
Directly install RHive inside R shell
1. Configure Java
$ R CMD javareconf -e
2. run R
$ R → or alternative
$ sudo R
3. install RHive package, type this command in R shell
> install.packages(“RHive”)

Next : connecting R with Hive