MathGroup Archive 2012

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

Search the Archive

Re: Data Format

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127532] Re: Data Format
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Thu, 2 Aug 2012 04:51:02 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Please consider the following code, which is data imported directly into
Mathematica via a .mtp file (Minitab Portable Worksheet), and then using
list assignment:

    list = {"C1" -> {5.`, 4.`, 7.`, 3.`, 6.`, 6.`, 7.`, 1.`, 5.`, 6.`}, "C2"
-> {2.`, 5.`, 6.`, 7.`, 7.`, 1.`, 5.`, 4.`, 7.`, 2.`}}

The following two commands work:

    Mean["C1" /. list]

    Mean["C2" /. list]

However I would prefer to be able to issue the following commands instead:

    Mean[C1]

    Mean[C2]

How can the code at top be converted so that these simpler commands will
work?

Thanks.

Nicholas Kormanik

Hi, Nicholas,

I cannot tell what is it for a file, .mtp, but it is quite clear what the output means and how to operate further.

The notation

"C1" -> {5.`, 4.`,.}

means that the string C1 will from now be the corresponding list. It is not what you want, I guess you need a plain list. Part[ ] will help:

list = {"C1" -> {5.`, 4.`, 7.`, 3.`, 6.`, 6.`, 7.`, 1.`, 5.`, 6.`},
   "C2" -> {2.`, 5.`, 6.`, 7.`, 7.`, 1.`, 5.`, 4.`, 7.`, 2.`}};

lst1 = list[[1, 2]]
lst2 = list[[2, 2]]
lst3 = {lst1, lst2}


{5., 4., 7., 3., 6., 6., 7., 1., 5., 6.}

{2., 5., 6., 7., 7., 1., 5., 4., 7., 2.}

{{5., 4., 7., 3., 6., 6., 7., 1., 5., 6.}, {2., 5., 6., 7., 7., 1.,
  5., 4., 7., 2.}}

You may now operate as usually. For example here is Mean acting on the first sublist:

Mean[lst1]

5.

If you have not done this before, have a look into Menu/Help/Part, Menu/Help/ExpressionStructure and Menu/Help/PartsOfExpressions.

Have fun, Alexei


Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at iee.lu






  • Prev by Date: Partial derivative function definitions
  • Next by Date: Graph background & Manipulate
  • Previous by thread: Re: Data Format
  • Next by thread: Re: Data Format