sandy
unread,Feb 28, 2012, 3:55:10 AM2/28/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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