I'm new to RHadoop and also to RMR... I had an requirement to write a Mapreduce job in R Mapreduce. I have tried writing, but while executing this, it gives an error. I'm trying to read the file from hdfs
.
I know how to do this in R: output <- lm(cnt~temp+hum,data)
I tried to implement the code below, but it is throwing this error...
Error:
Error in mr(map = map, reduce = reduce, combine = combine, vectorized.reduce, :
hadoop streaming failed with error code 1
Code:
input = "/hdfs/bikes_LR/day.csv",
map=
function(.,Xi){
yi =c[Xi[,1],]
Xi = Xi[,-1]
keyval(1,list(t(Xi)%*%yi))
},
reduce = TRUE ,
combine = TRUE)))[[1]]
solve(XtX,XtY)
Input:
instant,dteday,season,yr,mnth,holiday,weekday,workingday,weathersit,temp,atemp,hum,windspeed,casual,registered,cnt
1,2011-01-01,1,0,1,0,6,0,2,0.344167,0.363625,0.805833,0.160446,331,654,985
2,2011-01-02,1,0,1,0,0,0,2,0.363478,0.353739,0.696087,0.248539,131,670,801
3,2011-01-03,1,0,1,0,1,1,1,0.196364,0.189405,0.437273,0.248309,120,1229,1349
4,2011-01-04,1,0,1,0,2,1,1,0.2,0.212122,0.590435,0.160296,108,1454,1562
5,2011-01-05,1,0,1,0,3,1,1,0.226957,0.22927,0.436957,0.1869,82,1518,1600