Re: Extract values and multilpicities from list
- To: mathgroup at smc.vnet.net
- Subject: [mg64898] Re: Extract values and multilpicities from list
- From: Mark_robert.holt at kcl.ac.uk
- Date: Tue, 7 Mar 2006 06:11:48 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Is using a standard package add-on allowed? If so how about:
lstIn = {2, 3, 4, 4, 2, 1, 1, 5, 4};
<< Statistics`DataManipulation`
lstOut = Reverse /@ Frequencies[lstIn]//Timing;
{0. Second, {{1, 2}, {2, 2}, {3, 1}, {4, 3}, {5, 1}}}
randlstIn = Table[Random[Integer, {1, 15}], {1000000}];
randlstOut = Reverse /@ Frequencies[randlstIn] // Timing
{0.406 Second, {{1, 67038}, {2, 66567}, {3, 66722}, {4, 66957}, {5, 66941}, {
6, 66362}, {7, 66733}, {8, 66995}, {9, 66574}, {10, 66962}, {11, 66659}, {
12, 66255}, {13, 66590}, {14, 66407}, {15, 66238}}}
Mark
Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=8803#p8803
Posted through http://www.mathematica-users.org [[postId=8803]]