Counting Elements in a List
- To: mathgroup at smc.vnet.net
- Subject: [mg27959] Counting Elements in a List
- From: "JOHN C ERB" <JOHN_C_ERB at prodigy.net>
- Date: Mon, 26 Mar 2001 05:27:07 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I have a list in which I want to count the number of times the 4th element (i.e., 4th column) meets certain specifications (e.g., where it greater than or equal to 8). I can do this by: mylist = {{1, 2, 3, 4}, {1, 2, 3, 5}, {1, 3, 4, 6}, {1, 3, 6, 9}, {2, 4, 7, 8}}; Length[Select[mylist, #[[4]] >= 8 &]] Surely, there is another, more direct, way of doing this using Count? Thank you, John C. Erb email: John_C_Erb at prodigy.net