Showing posts with label R. Show all posts
Showing posts with label R. Show all posts

Tuesday, May 24, 2016

0

R packages installation error solved

  • Tuesday, May 24, 2016
  • Most of the common error we are getting below  in R at the time of installing in R packages like(rJava,ggplot2...)




    Warning message:
    package ‘rJava’ is not available (for R version 3.0.2)


    In this post we ll see how to resolve this error.

    First login as root user 
    and type R and you ll get r prompt
    >

    then type 
     install.packages("rJava")
    it ll ask package mirror location give any one it ll installed without any issue.


    To confirm the package installation 
    try below line
    library(rJava)
    It won't throw any message so its installed .

    Read more...

    Thursday, April 28, 2016

    0

    Install R in Redhat 7.2

  • Thursday, April 28, 2016
  • Installation of R in redhat is simple.
    First download the below file

    wget http://public-yum.oracle.com/public-yum-ol7.repo

    open the downloaded file and change enabled property into 1
    vi public-yum-ol7.repo

    [ol7_latest]
    enabled=1
    
    [ol7_addons]
    enabled=1
    [ol7_optional_latest]
    enabled = 1

    then
     sudo yum install R.x86_64

    Now R is installed.. 
    typr R you ll get 

    R>
    error:

    If you are getting below error 
     
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
     
    GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle"

     
    Try the below command to download oracle gpg file
    
    
     
    wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    then
    sudo yum install R.x86_64
     
    issue has resolved..

    
    
    Read more...

    Monday, November 9, 2015

    0

    Connect R with MYSQL database

  • Monday, November 9, 2015
  • R is simple and has more features.
    In this post we can see how write R code to connect Mysql DB which is installed in azure platform.

    I am using R studio .


     RJDBC package to connect Mysql.
    First install RJDBC  by using following command in R studio

    Here we are insert records in table and fetch the result by R script

    DB name is Department
    Table name is Maths

    install.packages("RJDBC")

    mydb = dbConnect(MySQL(), user='root', password='root', host='jay_hadoop.cloudapp.net', dbname="Department")

    To insert value in Maths table

    query1=dbGetQuery(mydb, "INSERT INTO Maths (StudentName, City) VALUES ('Saswath','Bangalore');")

    To fetch values from table Maths

    table_values <-dbGetQuery(mydb, "select * from Maths")

    print(table_values)


    You will get 

    Saswath   Bangalore

    then finally close the connection by

    dbDisconnect(mydb)


    Results are stored in Dataframe table_values , Now you can write r dataframe code .  RJDBC is easy and simple to connect R with mysql.




    Read more...

    Subscribe