Sun Aug 18, 2019 6:55 am
Login Register Lost Password? Contact Us


Using R packages in embedded codes

Questions and comments related to the rHPCC integration plugin

Fri Oct 30, 2015 4:46 am Change Time Zone

Hi,

I was trying out external language support feature in R. I needed to call some functions in 'sentiment' package,for that i tried the below code

Code: Select all
dataset(out_Layout)  sent_analysis(dataset(Message_Layout) old_file) :=  EMBED(R)

     library(sentiment)
     out = old_file
     txt<-out[,2]
     txt = gsub("(RT|via)((?:\\b\\W*@\\w+)+)", "", txt)
     txt = gsub("@\\w+", "", txt)
     txt = gsub("[[:punct:]]", "", txt)
     txt = gsub("[[:digit:]]", "", txt)
     txt = gsub("http\\w+", "", txt)
     txt = txt[!is.na(txt)]
     names(txt) = NULL
     -----
     -----
     txt_class_pol = classify_polarity(txt, algorithm="Bayes")
     --------
     -------
  ENDEMBED;
   
   sent_analysis(in);


Here i am getting evaluation error while running

library(sentiment)
------
-----
classify_polarity(...)

Rest of the code works properly,without this function call.



Can anyone tell,how can we include libraries in embedded R code. Is it necessary to explicitly install the required packages before using it?If so,how should i do it?
Anjali
 
Posts: 20
Joined: Wed Feb 25, 2015 11:52 am

Mon Nov 09, 2015 1:22 pm Change Time Zone

I'm not really an expert on the use of R, but yes, you will need to use the standard R mechanisms to install R libraries on the cluster nodes.

Richard
richardkchapman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 109
Joined: Fri Jun 17, 2011 8:59 am


Return to R Plugin

Who is online

Users browsing this forum: No registered users and 0 guests

cron