[R] accessing dimension names
jim holtman
jholtman at gmail.com
Tue Dec 18 17:08:23 CET 2007
dimnames(y)[[paste('x', idx, sep="")]]
On Dec 18, 2007 6:01 AM, <born.to.b.wyld at gmail.com> wrote:
> I have a matrix y:
>
> > dimnames(y)
> $x93
> [1] "1" "2"
>
> $x94
> [1] "0" "1" "2"
> .................. so on (there are other dimensions as well)
>
>
>
> I need to access a particular dimension, but a random mechanism tells me
> which dimension it would. So, sometimes I might need to access
> dimnames(y)$x93, some other time it would be dimnames(y)$x94.. and so on.
> Now let that random dimension be idx, then dimnames(y)$paste('x',idx,sep='')
> doesn't work.
>
> Can anyone help?
>
> Thanks!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
More information about the R-help
mailing list