Getting Rcpp::not_compatible when executing coxph algorithm in mapreduce job

185 views
Skip to first unread message

Ashish Patha

unread,
Sep 13, 2013, 10:12:27 AM9/13/13
to rha...@googlegroups.com
I am executing coxph algorithm in map reduce and here is my code :

I have written my code in the same way for Survival it worked out for me but not working for Coxph.

Mapper function:
I have data set which consits of some fields so i am taking some required rows using cbind and passing them to reducer...

DeviceData.map.fn <- function(k,v) {
mapObject<-cbind(v[2],v[7],v[3])
keyval(1, mapObject)
}

Reducer function:

Slot,DeviceFailed,Temp are my row headers in my dataset

DeviceData.reduce.fn<-function(k,v)
{
result<-survfit(coxph(Surv(Slot,DeviceFailed)~Temp,data=v),type="aalen")
keyval(k,result)
}

i am getting following error:
Loading required package: survival
Loading required package: splines
Loading required package: rhdfs
Loading required package: methods
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for 'rhdfs', details:
  call: fun(libname, pkgname)
  error: Environment variable HADOOP_CMD must be set before loading package rhdfs
Warning in FUN(c("survival", "splines", "rhdfs", "rJava", "rmr2", "reshape2",  :
  can't load rhdfs
Loading required package: rmr2
Loading required package: Rcpp
Loading required package: RJSONIO
Loading required package: bitops
Loading required package: digest
Loading required package: functional
Loading required package: stringr
Loading required package: plyr
Loading required package: reshape2
terminate called after throwing an instance of 'Rcpp::not_compatible'
  what():  expecting a single value

I need help on this
1) Is My mapper and reduce function is correct ?
2) If correct why i am getting this error for coxph as the same thing worked for Survival analysis.


Antonio Piccolboni

unread,
Sep 13, 2013, 11:51:32 AM9/13/13
to RHadoop Google Group
No, you are not allowed to use an object of class survfit as a value. list(survfit ... will do the job. 
2) If correct why i am getting this error for coxph as the same thing worked for Survival analysis.
I don't know.


Antonio
 


--
post: rha...@googlegroups.com ||
unsubscribe: rhadoop+u...@googlegroups.com ||
web: https://groups.google.com/d/forum/rhadoop?hl=en-US
---
You received this message because you are subscribed to the Google Groups "RHadoop" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rhadoop+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages