Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg116448] Re: To put name to columns
  • From: Yves Klett <yves.klett at googlemail.com>
  • Date: Wed, 16 Feb 2011 04:32:47 -0500 (EST)
  • References: <ijdocr$fe1$1@smc.vnet.net>

Hi,

you may choose the following approach (in this case using rows):

data={"row1"->{1,2,3},"row2"->{4,5,6}};

selector={"row1","row2"};

selected=Prepend[#/.data,#]&/@selector;

selected
Transpose[selected]
{{row1,1,2,3},{row2,4,5,6}}
{{row1,row2},{1,4},{2,5},{3,6}}

which will display nicely with Grid.

This approach is quite convenient because you can define the selection
easily (and get the heading automatically), plus the data rows can be
supplied in any order. You can also use a Rule for each single entry,
but for large number of entries this will become ineffective.

Regards,
Yves


Am 15.02.2011 12:34, schrieb "Carlos J. Andrés Blasco":
> 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
> 
> 


  • Prev by Date: Re: Replace elements in a matrix
  • Next by Date: Re: Another point about Mathematica 8.0
  • Previous by thread: To put name to columns
  • Next by thread: Re: To put name to columns