Tuesday 7 July 2015

Resolve the installation problem of "rmongodb"

Being a new user of R as well as MongoDB, I wanted to make a mongoDB database connection with R but had to struggle before I could successfully establish the connection.
The version of R what I was using was 3.0.1, being old version whenever I was trying to install install.packages("rmongodb"), I was getting some error. Ultimately I had to upgrade the version of R using the following step and then I was able to install rmongodb package.
  • sudo gedit /etc/apt/sources.list
  • add the following line as I am using the version 14.04.2 (use the command lsb_release -c to see the name)
    • deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu trusty/
  •  gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
  • sudo apt-get update
  • sudo apt-get upgrade
Now new version is installed, within R I isuued the command sessionInfo(), which shows the R version 3.2.1 (2015-06-18).

Now use the following command to install mongodb package and connect to MongoDB
  • install.packages("rmongodb")
  • library(rmongodb)
  • To connect to local mongoD
    • mongo <- mongo.create()

Will keep on posting as I proceed towards using R, Shiny and MongoDB.

No comments:

Post a Comment