Grouping Data

13 views
Skip to first unread message

Pgs

unread,
Feb 26, 2015, 11:10:44 AM2/26/15
to haskel...@googlegroups.com
Hi
I have a txt file as per example below......

My txt file or data frame
col1, col2,col3,col4
A,    1,      4,      2
A ,   1,      8,      4
A ,   2,      6,      3
A     2,      9,      3
B,    1,      8,      4
B,    1,      4,      2

So,  I now want to apply a function to columns 3&4  but Group by columns 1&2

myfunction = minimum $ zipWith (/) col3 col4

This is where I am stuck!
I want to apply the function "myfunction" to cols 3& 4 and then get the minimum number per group set of columns 1&2

1st pass
col1, col2,col3,col4
A,    1,      2
A ,   1,      2
A ,   2,      2
A     2,      3
B,    1,      2
B,    1,      2

Below is the result set I'm looking for
2nd pass
A, 1, 2
A, 2, 2
B, 1, 2

Regards

Reply all
Reply to author
Forward
0 new messages