[R] Changing Matrix Header

Carlos J. Gil Bellosta cgb at datanalytics.com
Tue Jan 6 10:41:57 CET 2009


Hello,

colnames( dat ) <- NULL

will do the trick.

Carlos J. Gil Bellosta
http://www.datanalytics.com

On Tue, 2009-01-06 at 17:14 +0900, Gundala Viswanath wrote:
> Dear all,
> 
> I have the following matrix.
> 
> > dat
>          A A A A A A A A A A
>     [1,] 0 0 0 0 0 0 0 0 0 0
>     [2,] 0 0 0 0 0 0 0 0 0 1
>     [3,] 0 0 0 0 0 0 0 0 0 2
> 
> How can I change it into:
>          [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]   [,9]   [,10]
>     [1,] 0     0     0      0     0     0     0     0     0       0
>     [2,] 0     0     0      0     0     0     0     0     0       1
>     [3,] 0     0     0      0     0     0     0     0     0        2
> 
> 
> I tried:
> 
> > as.matrix(x)
> 
> But failed.
> 
> 
> - Gundala Viswanath
> Jakarta - Indonesia
> 
> ______________________________________________
> 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.




More information about the R-help mailing list