Re: [R] merging-binning data

2015-11-04 Thread Alaios via R-help
Thanks for your comments. Actually only the last group has a single element. The first group is always "full" of members and as that it works fine. Some constant spacing between the groups would be good as well and thus I will check quantiles. Thanks for the great support and time invested on th

Re: [R] merging-binning data

2015-11-04 Thread Boris Steipe
Whatever approach is "best" to define subsets depends completely on the semantics of the data. Your approach (a fixed number of equally spaced breaks) is the right one if the absolute ranges of the data is important. It should be obvious that either the top or the bottom group could contain only

Re: [R] merging-binning data

2015-11-04 Thread Boris Steipe
The breaks are just the min() and max() in your groups. Something like sprintf("[%5.2f,%5.2f]", min(dBin[groups==2]), max(dBin[groups==2])) ... should achieve what you need. B. On Nov 4, 2015, at 8:45 AM, Alaios wrote: > you are right. > by labels I mean the "categories", "breaks" that m

Re: [R] merging-binning data

2015-11-04 Thread Alaios via R-help
you are right.by labels I mean the "categories", "breaks" that my data fall in.To be part of group 2 for example you have to be in the range of [110,223) I need to keep those for my plots. Did I describe it more precisely now?Alex On Wednesday, November 4, 2015 2:09 PM, Boris Steipe wr

Re: [R] merging-binning data

2015-11-04 Thread Boris Steipe
I don't understand: - where does the "label" come from? (It's not an element of your data that I see.) - what do you want to do with this "label" i.e. how does it need to be associated with the data? B. On Nov 4, 2015, at 7:57 AM, Alaios wrote: > Thanks it works great and gives me group

Re: [R] merging-binning data

2015-11-04 Thread Alaios via R-help
Thanks it works great and gives me group numbers as integers and thus I can with which group the elements as needed (which (groups== 2)) Question though is how to keep also the labels for each group. For example that my first group is the [13,206) RegardsAlex On Wednesday, November 4, 20

Re: [R] merging-binning data

2015-11-04 Thread Boris Steipe
I would transform the original numbers into integers which you can use as group labels. The row numbers of the group labels are the indexes of your values. Example: assume your input vector is dBin nGroups <- 5 # number of groups groups <- (dBin - min(dBin)) / (max(dBin) - min(dBin)) # rescale

Re: [R] merging-binning data

2015-11-04 Thread Alaios via R-help
Thanks for the answer. Split does not give me the indexes though but only in which group they fall in. I also need the index of the group. Is the first, the second .. group?Alex On Tuesday, November 3, 2015 5:05 PM, Ista Zahn wrote: Probably split(binDistance, test). Best, Ista

Re: [R] merging-binning data

2015-11-03 Thread Ista Zahn
Probably split(binDistance, test). Best, Ista On Tue, Nov 3, 2015 at 10:47 AM, Alaios via R-help wrote: > Dear all,I am not exactly sure on what is the proper name of what I am trying > to do. > I have a vector that looks like > binDistance >[,1] > [1,] 238.95162 > [2,] 143.0859

[R] merging-binning data

2015-11-03 Thread Alaios via R-help
Dear all,I am not exactly sure on what is the proper name of what I am trying to do. I have a vector that looks like  binDistance    [,1]  [1,] 238.95162  [2,] 143.08590  [3,]  88.50923  [4,] 177.67884  [5,] 277.54116  [6,] 342.94689  [7,] 241.60905  [8,] 177.81969  [9,] 211.25559 [10,] 27