Re: Accessing Elements of Arrays in TableForm
- To: mathgroup at smc.vnet.net
- Subject: [mg61680] Re: Accessing Elements of Arrays in TableForm
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Wed, 26 Oct 2005 01:01:35 -0400 (EDT)
- Organization: Uni Leipzig
- References: <djk2bl$h3q$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
dat = Table[Random[], {4}, {4}] // TableForm
dat[[1, 2, 2]]
Regards
Jens
"Gregory Lypny" <gregory.lypny at videotron.ca>
schrieb im Newsbeitrag
news:djk2bl$h3q$1 at smc.vnet.net...
| Hello Everyone,
|
| I've created a fairly inelegant function for
computing seven
| descriptive statistics on the columns of a
matrix: total, mean,
| median, and so on. It looks like this.
|
| DescStatsIntegerForm[x_] :=
| Transpose[
| Flatten[
| Round[
| {{Total[x]}, {Mean[x]},
| {Median[x]}, {StandardDeviation[x]},
| {SampleRange[x]}, {Apply[Min,
x\[Transpose], 2]}, {Apply[Max,
| x\[Transpose], 2]}}], 1]]
|
| For the results to read easily, I could make
TableForm part of
| the function as below, where the user supplies
the names of the
| series (the columns) and the names of the
statistics are hard-wired
| into the function. This will produce a nice
table with variable
| names as the row headings and the names of the
statistics as column
| headings. The problem is that individual
elements, such as (3, 4),
| are no longer accessible. Is there any way
around this? That is,
| can functions be built so that their output is
in table form and
| their individual elements can still be
referenced for further
| calculations?
|
| Any advice would be most appreciated.
|
| DescStatsIntegerFormTable[x_, varNamesList_] :=
| TableForm[
| Transpose[
| Flatten[
| Round[
| {{Total[x]}, {Mean[x]},
| {Median[x]}, {StandardDeviation[x]},
| {SampleRange[x]}, {Apply[Min,
| x\[Transpose], 2]}, {Apply[Max,
x\[Transpose], 2]}}], 1]],
| TableHeadings -> {varNamesList, {"
| Total", "Mean", "Median", "S.d",
"Range", "Min.", "Max."}}]
|
| Regards,
|
| Greg
|