Skip to main content
15 events
when toggle format what by license comment
Feb 5, 2015 at 21:04 comment added Basheer Algohi @Mr.Wizard thanks for the up voting and for the new thinks I learned about ## :-), ^_ _
Feb 5, 2015 at 13:45 comment added Mr.Wizard By the way this can be written Cases[testdat, {# | ##2, __}] & @@@ {{1, 2}, {3, 4, 5}, {6}} if you like that sort of weirdness. :^)
Feb 5, 2015 at 13:43 comment added Mr.Wizard @Algohi It's not really bad however with the example given (only three groups) so +1 for a clean method nevertheless.
Feb 5, 2015 at 13:27 comment added Basheer Algohi @Mr.Wizard I Agree. The input list is scanned once for each group.
Feb 5, 2015 at 13:12 comment added Mr.Wizard This code is less than optimal because the input list will be scanned once for each group.
Dec 12, 2014 at 3:55 comment added ramesh Let us continue this discussion in chat.
Dec 11, 2014 at 19:58 comment added Basheer Algohi does this resemble your problem? Cases[RandomInteger[20, {200, 3}], {Alternatives[##], __}] & @@@ Partition[Range[20], 3]
Dec 11, 2014 at 16:55 comment added ramesh I did try this but I get all blanks. Let me work more on it and get back to you.
Dec 11, 2014 at 16:38 comment added Basheer Algohi you mean newindex=Partition[oldindex, 3]? use index instead of {index} in my code. like this: Cases[testdat, {Alternatives[##], __}] & @@@newindex
Dec 11, 2014 at 16:06 comment added ramesh @ Algohi, thanks for your update. I think, this might serve my need. I am working on it thought on my real data set.
Dec 11, 2014 at 15:53 history edited Basheer Algohi CC BY-SA 3.0
added 296 characters in body
Dec 11, 2014 at 15:37 comment added ramesh In your code, you have {{1, 2}, {3, 4, 5}, {6}} as criterion. Can we specify criteria as function than list? Like index is between two numbers: i<=index<=i+1, {i, 1, 6, 2}. Something like this.
Dec 11, 2014 at 15:24 comment added Basheer Algohi if you have too big data then cases is your choose because it is fast. i don't get what you mean be index is too big to navigate? as long as you have the criteria to group the rows then you can use this method.
Dec 11, 2014 at 15:21 comment added ramesh @ Algohi, thank you for your answer. What if I have a large data and index is too big to navigate. In fact, I have over 2M obs.
Dec 11, 2014 at 15:15 history answered Basheer Algohi CC BY-SA 3.0