Hello,

> A = matrix(0, 3,3)
> rownames(A) = c("A", "B", "C")
> A
  [,1] [,2] [,3]
A    0    0    0
B    0    0    0
C    0    0    0

HTH,

Thanks,

Paolo

On 15 May 2012 10:19, Gundala Viswanath <gundalav@gmail.com> wrote:

> I have the following matrix:
> > dat
>
>                      [,1]      [,2]       [,3]        [,4]
> foo 0.7574657 0.2104075 0.02922241 0.002705617
> foo 0.0000000 0.0000000 0.00000000 0.000000000
> foo 0.0000000 0.0000000 0.00000000 0.000000000
> foo 0.0000000 0.0000000 0.00000000 0.000000000
> foo 0.0000000 0.0000000 0.00000000 0.000000000
> foo 0.0000000 0.0000000 0.00000000 0.000000000
>
> and given this:
>
> > new_names <- c("k0","k1","k2,"k3","k4","k5");
>
>
> How can I get this?
>
>
>                      [,1]      [,2]       [,3]        [,4]
> k0 0.7574657 0.2104075 0.02922241 0.002705617
> k1 0.0000000 0.0000000 0.00000000 0.000000000
> k2 0.0000000 0.0000000 0.00000000 0.000000000
> k3 0.0000000 0.0000000 0.00000000 0.000000000
> k4 0.0000000 0.0000000 0.00000000 0.000000000
> k5 0.0000000 0.0000000 0.00000000 0.000000000
>
> best,
> GV.
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]

