Model=c("AMC","AMC","AMC","Buick","Buick")
MPG=c(22,17,22,20,15)
WEIGHT=c(2930,3350,2640,3250,4080)
PRICE=c(4099,4749,3799,4816,7827)
Cars1=data.frame(Model,MPG,WEIGHT,PRICE)
Cars<-to.dfs(Cars1)
out<-mapreduce(Cars,
map=function(k,v){
keyval(v$Model,v$PRICE)
},
reduce=function(k,vv){
keyval(k,sum(vv))
}
)
out1<-from.dfs(out)
View(out1)
map.R=function(k,v){
keyval(v$Month,v$Distance)
}
reduce.R=function(k,vv){
keyval(k,sum(vv))
}
deptdelay <- function (input, output,pattern=","){
mapreduce(input = input,output=output,
input.format = make.input.format("csv", sep = ","),
map = map.R,reduce=reduce.R)}
hdfs.root <- '/user/dir1/'
hdfs.data <- file.path(hdfs.root, 'flights.csv')
hdfs.out <- file.path(hdfs.root, 'out')
out <- deptdelay(hdfs.data, hdfs.out)
15/04/03 03:16:08 INFO mapreduce.Job: Job job_1428054454059_0002 completed successfully 15/04/03 03:16:09 INFO mapreduce.Job: Counters: 49
Map-Reduce Framework Map input records=227497 Map output records=0 Map output bytes=0 Map output materialized bytes=12 Input split bytes=218 Combine input records=0 Combine output records=0 Reduce input groups=0 Reduce shuffle bytes=12 Reduce input records=0 Reduce output records=0 Spilled Records=0 Shuffled Maps =2 Failed Shuffles=0 Merged Map outputs=2 GC time elapsed (ms)=1900 CPU time spent (ms)=39570 Physical memory (bytes) snapshot=547024896 Virtual memory (bytes) snapshot=2714505216 Total committed heap usage (bytes)=396361728
--
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/d/optout.