[R] Array Dimension Names

2003-10-31 Thread Benjamin . STABLER
I would like to reference array dimensions by name in an apply and a summary function. For example: apply(x, workers, sum) Is there a better way to do this than creating a new attribute for the array and then creating new methods for apply and summary? I don't want to name the individual

Re: [R] Array Dimension Names

2003-10-31 Thread Ben Bolker
Not that I know of. BUT dimnames can themselves have names attributes, so a very small hack to apply() will do what you want. I did dump(apply,file=apply.R) and added the following lines after dn - dimnames(X) (line 14) [this is in R 1.7.1]. if (is.character(MARGIN)) { if

RE: [R] Array Dimension Names

2003-10-31 Thread Benjamin . STABLER
for the MARGIN argument to apply and sweep, and the perm argument to aperm. Thanks again, Ben Stabler -Original Message- From: Tony Plate [mailto:[EMAIL PROTECTED] Sent: Friday, October 31, 2003 1:07 PM To: STABLER Benjamin; [EMAIL PROTECTED] Subject: Re: [R] Array Dimension Names You can

RE: [R] Array Dimension Names

2003-10-31 Thread Gabor Grothendieck
] Array Dimension Names I would like to reference array dimensions by name in an apply and a summary function. For example: apply(x, workers, sum) Is there a better way to do this than creating a new attribute for the array and then creating new methods for apply and summary? I don't want to name