I have data which contains position in one column and values in other columns. I wanted to plot a line graph by binning the rows. there are more than 50,000 rows, so i want to bin data in to 50 bins and calculate average for values in the columns. Here is my input sample data. position sample_1 sample_2 sample_3 sample_4 1001 21 43 28 35 1002 22 42 29 38 1003 23 46 23 42 1004 26 43 26 46 1005 31 31 31 43 1006 26 35 26 31 1007 18 36 24 35 1008 19 37 23 39 1009 21 34 22 23 1010 31 24 21 26 1011 32 23 20 31 1012 34 36 22 26 1013 25 43 23 25 1014 27 42 26 27 1015 26 46 26 26 1016 35 47 31 28 The output i am looking for is after binning sample data in to 4 columns and data is averaged for other samples. The output i am expecting from sample data is Bin sample_1 sample_2 sample_3 sample_4 1001-1004 23 43.5 26.5 40.25 1005-1008 23.5 34.75 26 37 1009-1012 29.5 29.25 21.25 26.5 1013-1016 28.25 44.5 26.5 26.5 Continue reading...