[R] how to extract row& col names from a matrix

Kristel Joossens kristel.joossens at econ.kuleuven.be
Tue Dec 6 11:02:24 CET 2005


You mean somthing like the following?
cat("(");cat(rownames(a),sep=",");cat(")")
cat("(");cat(colnames(a),sep=",");cat(")")

Best regrads,
Kristel

shanmuha boopathy wrote:
> Dear all,
>   I like to extract row names & column names from the named matrix......
>    
>   like......
>    
>    a<-matrix(1:6,2)
>  ro<-c("aa","bb")
>  co<-c("dd","ee","ff")
>  dimnames(a)<-list(ro,co)
> a
>   
>  >
>     dd ee ff
> aa  1  3  5
> bb  2  4  6
>    
>   from the above matrix "a"
>   I like to extract
>   rownames separately like rownames(a)= (aa,bb)
>     column names separately like col names(a)= (dd,ee,ff)
>    
>   Kindly suggest me some good ways.......
> 
>   tha´nk you all
>    
>   with regards,
>   boopathy.
> 
> 
> 
> 
> Thirumalai Shanmuha Boopathy, 
> Zimmer no : 1109,
> Rütscher strasse 165, 
> 52072  Aachen . 
> Germany.
>  
> Home zone   :  0049 - 241 - 9813409
> Mobile zone :  0049 - 176 - 23567867
> 
> 
> 
> 
> 
> 		
> ---------------------------------
> 
>  Single? There's someone we'd like you to meet.
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
__________________________________________
Kristel Joossens        Ph.D. Student
Research Center ORSTAT  K.U. Leuven
Naamsestraat 69         Tel: +32 16 326929
3000 Leuven, Belgium    Fax: +32 16 326732
E-mail:  Kristel.Joossens at econ.kuleuven.be
http://www.econ.kuleuven.be/public/ndbae49

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm




More information about the R-help mailing list