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
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
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
] 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