Thank you very much, Jim and Henrique,

The solution I expected but was unable to figure out myself was Jim's:
table.a[,,1] to access the third dimension.

The solution by Henrique was unexpected, bit more specific but perfect
for my purpose and very elegant.

I will make use of both in the future.

Great, thank you again!
Stefan

Jim Lemon schrieb, Am 05.11.2008 11:53:
Stefan Uhmann wrote:
Dear list,

I have a multi(3)dimensional table, which is printed as two tables:

table.a
, ,  = female


      not at all a little medium heavy
  no          53       27      8     6
  yes         30       67     61    66

, ,  = male


      not at all a little medium heavy
  no          31       20     11     5
  yes          5       19     34    25

How can I access (manipulate) only the first table (female)?
I want to calculate the percentages for each gender group, i.e. dividing each table/array by the sum of of this table/array. And I want to keep the structure you see, because I use it already for plotting the data.

Hi Stefan,
Would something like this work?

100*table.a[,,1]/rowSums(table.a[,,1])


Jim



______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to