Choosing key and value from a dataframe

42 views
Skip to first unread message

Beta

unread,
Mar 26, 2015, 12:31:23 PM3/26/15
to rha...@googlegroups.com
Hi,

This is again a very basic question in RHadoop environment programming.

Suppose I've a dataframe, say airlines data. Now I want to summarize flights delay by airline (e.g. AA, UA). My question is how will I choose key-value pair from the airline dataframe.

I tried Jeffery Breen's example. He did v['variable_name'] to select key and value variable. But when I'm trying using some other example I'm getting error.

One of the Jeffery Breen's example I tried.


I'll be extremely grateful if somebody can share an example code. 

Regards.

Antonio Piccolboni

unread,
Mar 26, 2015, 12:40:18 PM3/26/15
to RHadoop Google Group
with rmr2

 from.dfs(mapreduce(to.dfs(mtcars), map = function(k,v) keyval(v$gear, v), reduce = function(k,v) t(colMeans(v))))

with plyrmr

 input(mtcars) %|% group(gear) %|% gapply(function(x) t(colMeans(x)))

--
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.

Beta

unread,
Mar 27, 2015, 10:33:35 AM3/27/15
to rha...@googlegroups.com, ant...@piccolboni.info
Thanks a Lot Antonio! You had been most helpful. I was trying the code with rmr2 and you solution worked.
Reply all
Reply to author
Forward
0 new messages