PCA function erroring out while using it with RHIPE

118 views
Skip to first unread message

sandy

unread,
Feb 28, 2012, 3:55:10 AM2/28/12
to Bangalore R Users - BRU
Hi ,

I am trying to apply PCA funtion for dataset in reducer and it is
erroring out with following message (Error in eval({ : could not find
function "PCA").


code:-


#! /usr/bin/env Rscript
library(Rhipe)
rhinit(TRUE,TRUE)
library(FactoMineR)


map<-expression({
extractPCAIPut = function(line){
fields <- unlist(strsplit(line, "\\,"))
valueline<-paste(line,",","\n")
print(fields[1])
rhcollect(fields[1],valueline)
}
lapply(map.values, extractPCAIPut)


})


reduce<-expression(
pre = {
delays <- numeric(0)
},
reduce = {
line <- c(line,reduce.values)
},
post={
#print(line)
line<-unlist(strsplit(paste(reduce.values), "\n"))
countline<-length(line)
word<-unlist(strsplit(line[1],","))
col<-length(word)
clustermat<-matrix(0, nrow = countline, ncol = col-1)
colval<-NULL
for(i in 1:length(line)){
words<-NULL
words<-unlist(strsplit(line[i],","))
colval<-NULL
wordlen<-length(words)-1
for(j in 1:wordlen){
colval<-cbind(colval,as.numeric(words[j]))
}
clustermat[i,]=colval
}
clustmatdf= data.frame(clustermat)
out<-PCA(input) rhcollect(reduce.key,out)
}
)

inputPath<-"/PCAIO"
outputPath<-"/PCAOUT"


ab <- rhmr(map=map,reduce=reduce,
ifolder=inputPath,ofolder=outputPath,
inout=c('text','text'),jobname="PCA",
mapred=list(mapred.reduce.tasks=2))
rhex(ab)


results <- rhread(paste(outputPath, "/part-*", sep = ""), type =
"text")
write(results, file="pcaOut.dat")


Error message:-


R ERROR BEGIN (reduce):
=============


Error in eval({ : could not find function "PCA"


R ERROR END
===========


at org.godhuli.rhipe.RHMRHelper
$MRErrorThread.run(RHMRHelper.java:391)


at
org.godhuli.rhipe.RHMRHelper.checkOuterrThreadsThrowable(RHMRHelper.java:
236)
at org.godhuli.rhipe.RHMRReducer.run(RHMRReducer.java:68)
at
org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:
566)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:
408)
at org.apache.hadoop.mapred.Child.main(Child.java:170)


can any one please help in fixing the issue.


Thanks in advance



Shekhar

unread,
Feb 28, 2012, 4:37:10 AM2/28/12
to Bangalore R Users - BRU
Hi,
Are you running Hadoop in pseudo or cluster mode? if you are running
in cluster mode, make sure that the package is available in every
node?
I also would like to know that whether you have build R from source or
using binary (installed using yum). i guess its unable to load the
package
FactoMineR where the function in question is defined.

Regards,
SOm
On Feb 28, 1:55 pm, sandy <sandeepbupath...@gmail.com> wrote:
> Hi

sandy

unread,
Feb 28, 2012, 8:18:33 PM2/28/12
to Bangalore R Users - BRU
Hi ,

Yes i am using pseudo mode cluster and trying to use FactoMineR. I
have used R tar.dz file and extracted it and used ./configure and
make , and it got installed.after some research i found that it
dependent packages are not getting loaded due to version
compatibility. Let me try upgrading R to next version. can i get
lattice package download for R 2.13 because CRAN provides only for R
2.14 and above.

Thanks
Sandeep
Reply all
Reply to author
Forward
0 new messages