MathGroup Archive 2011

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

Search the Archive

Re: To put name to columns

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116469] Re: To put name to columns
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Wed, 16 Feb 2011 04:36:34 -0500 (EST)

On 2/15/11 at 6:35 AM, cjandres at ono.com ("Carlos J. Andr=C3=A9s Blasco")
wrote:

>Please, how to put name to each column in a table with several
>columns, when you insert a grid? The idea is to manipulate these
>columns by means of their names, for example to find out the
>average, standard devaition, etc Thank you Carlos J,. Andres

I accomplish this by making the first row of a data array a list
of symbols with no assigned values. I use the function below, to
extract one or more columns from the data array

Columns[data:{___List},n:{__Symbol}]:=
   data[[All,Flatten[Position[First[data],#]&/@n]]]


So, say the first row of my data array was {a,b,c,d} and I
wanted the mean for column a. I would do

Mean@Rest@Columns[data, {a}]

I actually have written a package of several commands that allow
me to do a variety of useful things based on the scheme above.
If you are interested in the package contact me offline and I
will be happy to send it to you as is. I have thought about
making this package available on Mathsource. But, I've never
taken the time to write examples and documentation for the
functions in the package. The only thing I've created is usage
messages that describe what the functions do with syntax.



  • Prev by Date: Re: NInegrate Bug
  • Next by Date: Re: To put name to columns
  • Previous by thread: Re: To put name to columns
  • Next by thread: Re: To put name to columns