MathGroup Archive 2005

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

Search the Archive

Re: Re: formatting table with integers and floats in a column

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61417] Re: [mg61359] Re: formatting table with integers and floats in a column
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Tue, 18 Oct 2005 02:45:25 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <disloi$mjg$1@smc.vnet.net> <200510170629.CAA16204@smc.vnet.net>
  • Reply-to: murray at math.umass.edu
  • Sender: owner-wri-mathgroup at wolfram.com

Alas, that does NOT do what I require: while the integers among the 
numbers are right-aligned with respect to one another, the decimal point 
in the floats is aligned with the right-most digit of those integers 
rather than to the right of those right-most digits.

I require that the numbers be aligned "as if" they were aligned on 
decimal points, except that the decimal points of the integers do not 
actually appear.


Steve Luttrell wrote:
> This does what you want:
> 
> PaddedForm[TableForm[Transpose[{statNames, statNumbers}]],3]
> 
> Steve Luttrell
> 
> "Murray Eisenberg" <murray at math.umass.edu> wrote in message 
> news:disloi$mjg$1 at smc.vnet.net...
> 
>>I have a 2-column table whose first column consists of strings --
>>
>> statNames = {"N", "Max", "Min", "Mean", "Std.dev.", "Median"};
>>
>>-- and a column of corresponding numbers:
>>
>> statNumbers = {40, 103, 2, 56.8, 22.5, 59};
>>
>>If I use
>>
>>  TableForm[Transpose[{statNames, statNumbers}]]
>>
>>then of course all the numbers will be left-aligned on their leftmost
>>digits.
>>
>>I want to format the numbers in the table so that they will appear as
>>follows:
>>
>>N         40
>>Max      103
>>Min        2
>>Mean      56.8
>>Std.dev.  22.5
>>Median    59
>>
>>Notice that I want the integers to appear as integers -- WITHOUT any
>>trailing decimal point; but the alignment is to be as if the numbers
>>were aligned on the decimal points including the implicit, but
>>unprinted, decimal points in the integers.
>>
>>How??
>>
>>I've tried various things with mapping NumberForm onto the individual
>>numbers but cannot quite get the correct effect.
>>
>>-- 
>>Murray Eisenberg                     murray at math.umass.edu
>>Mathematics & Statistics Dept.
>>Lederle Graduate Research Tower      phone 413 549-1020 (H)
>>University of Massachusetts                413 545-2859 (W)
>>710 North Pleasant Street            fax   413 545-1801
>>Amherst, MA 01003-9305
>>
> 
> 
> 
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: Re: formatting table with integers and floats in a column
  • Next by Date: Re: How smooth graphs?
  • Previous by thread: Re: formatting table with integers and floats in a column
  • Next by thread: Re: formatting table with integers and floats in a column