[R] return vector of element names for vector, matrix or array

Michael Friendly friendly at yorku.ca
Sun Nov 28 15:54:01 CET 2010


On 11/27/2010 6:13 PM, Joshua Wiley wrote:
> Interesting use of outer, but I think you're overthinking it ;)
>
> expand.grid(dimnames(x3))
Ah, thanks.  I guess I was thinking outer the box ;-)
> If you want it as a vector separated by colons...
>
> apply(expand.grid(dimnames(x3)), 1, paste, collapse = ":")
>
>


-- 
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA



More information about the R-help mailing list