[R] Split rownames into factors

Bill.Venables at csiro.au Bill.Venables at csiro.au
Tue Jul 28 08:21:17 CEST 2009


?substring 


Bill Venables
http://www.cmis.csiro.au/bill.venables/ 


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of jimdare
Sent: Tuesday, 28 July 2009 8:10 AM
To: r-help at r-project.org
Subject: [R] Split rownames into factors


Hi Guys,

I was wondering how you would go about solving the following problem:

I have a list where the grouping information is in the row names.

Rowname [,1]

X1Jan08  324
X1Jun08  65
X1Dec08  543
X2Jan08  23
X2Jun08  54
X2Dec08  8765
X3Jan08  213
X3Jun08  43
X3Dec08  65

How can I create the following dataframe:
       Value    Date    Group
[1,]  324      Jan 08    X1
[2,]  65       Jun 08    X1
[3,]  543     Dec 08    X1
 etc.................

Thanks for your help!
James

-- 
View this message in context: http://www.nabble.com/Split-rownames-into-factors-tp24689181p24689181.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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