MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Counting Elements in a List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27969] RE: [mg27959] Counting Elements in a List
  • From: "Harvey P. Dale" <hpd1 at nyu.edu>
  • Date: Tue, 27 Mar 2001 01:26:06 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

John:
	Count[Transpose[mylist][[4]], x_/;x>3]
	Best,
	Harvey
Professor Harvey P. Dale
Director
National Center on Philanthropy and the Law
New York University School of Law
Room 206A
110 West 3rd Street
New York, N.Y. 10012-1074


 -----Original Message-----
From: 	JOHN C ERB [mailto:JOHN_C_ERB at prodigy.net] 
To: mathgroup at smc.vnet.net
Sent:	Monday, March 26, 2001 5:27 AM
To:	mathgroup at smc.vnet.net
Subject:	[mg27959] Counting Elements in a List

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



  • Prev by Date: Real (but trivial) interface "bug" (deficiency) in Mac 4.0 front end
  • Next by Date: Re: Counting Elements in a List
  • Previous by thread: Re: Counting Elements in a List
  • Next by thread: Re: Counting Elements in a List