Displaying 2 results from an estimated 2 matches for "dimnamenam".
Did you mean:
dimnamename
1999 Nov 03
1
Dimnamenames (PR#257)
I've just started digging into Andreas's old report:
> a <- array(0,c(2,2,2));
> dimnames(a)<-list(hansi=1:2, pepi=c("a","b"), karli=3:4)
> dimnames(a[,,1]) # losing component names
[[1]]
[1] "1" "2"
[[2]]
[1] "a" "b"
Now, this would be fairly easily fixed (I think) which would also make
it compatible with S3.
2010 Jul 29
1
Using 'dimname names' in aperm() and apply()
...;,"from") )
res <-apply( y, "to", sum)
--
This makes the array much easier to handle than having to keep track
which dimension currently means what.
For aperm and apply, the change seems very simple - one new function,
and an additional line in each.
----------
dimnum.from.dimnamename <- function(A, dimensions)
{
if( is.character(dimensions) ) {
n <- names(dimnames(A))
if( !is.null(n) ) {
dimnum <- seq( along=n)
names(dimnum) <- n
dimensions <- dimnum[dimensions]
}
}
dimensions
}
aperm <- function (a, perm, resi...