[R] How to label a "vector"

Henrique Dallazuanna wwwhsd at gmail.com
Wed Oct 1 15:41:22 CEST 2008


Use dimnames:

dimnames(Z) <- list(c("X1", "X2"), c("X1", "X2", "X3"))

On Wed, Oct 1, 2008 at 10:38 AM, cruz <cruadam at gmail.com> wrote:
> Hi,
>
> I have an object, Z:
>
>> typeof(Z)
> [1] "list"
>
> It looks like:
>
>     [,1] [,2] [,3]
> [1,]  1    1    1
> [2,]  1    1    1
>
> How can it label the Rows and Columns with Text? so that it looks like:
>
>     Y1  Y2  Y3
> X1   1    1    1
> X2   1    1    1
>
>
>
> Thanks,
> cruz
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list