[R] the real dimnames
Allan Engelhardt
allane at cybaea.com
Mon Jul 26 22:05:42 CEST 2010
On 26/07/10 19:01, Michael Lachmann wrote:
> Hi,
>
> R seems to have a feature that isn't used much, which I don't really
> now how to call. But, the dimnames function, can in addition to giving
> names to rows/columns/dim 3 rows/dim 4 rows... can also give labels to
> the dimensions themselves.
>
> Thus, I can do:
> A = matrix(1:9,3,3)
>
> dimnames(A) = list(from=c(), to=c() )
If you just want to set the names of the dimnames, just do
names(dimnames(A)) <- c("from", "to")
Remember that dimnames is a list and all lists have names.
Allan
More information about the R-help
mailing list