Skip to content
Back to formatted view

Raw Message

Message-ID: <1343681934.61075.YahooMailNeo@web142603.mail.bf1.yahoo.com>
Date: 2012-07-30T20:58:54Z
From: arun
Subject: Appending the column names
In-Reply-To: <1343679475719-4638421.post@n4.nabble.com>

Hello,

It's not "Colnames".? It is colnames().? Also, you should use stringsAsFactors=FALSE.

?I tried to reply it to nabble.? But, seems like nabble webpage is redirecting to some porn site.? 

Anyway,

X<-read.table(text="
??? Summary??? G????? Y???? R
????? Acc?????????????? 12??? 12?? 13
????? Bcc?????????????? 11??? 14?? 15
????? Ccc?????????????? 13??? 15?? 16
",sep="",header=TRUE,stringsAsFactors=FALSE)
Y<-read.table(text="
?? Summary??? G????? Y???? R
????? Acc?????????????? 10??? 11?? 12
????? Bcc?????????????? 13??? 12?? 11
????? Ccc?????????????? 11??? 16?? 20
",sep="",header=TRUE,stringsAsFactors=FALSE)
Z<-rbind(X,colnames(Y),Y)
?Z
? Summary? G? Y? R
1???? Acc 12 12 13
2???? Bcc 11 14 15
3???? Ccc 13 15 16
4 Summary? G? Y? R
5???? Acc 10 11 12
6???? Bcc 13 12 11
7???? Ccc 11 16 20

A.K.




----- Original Message -----
From: namit <saileshchowdary at gmail.com>
To: r-help at r-project.org
Cc: 
Sent: Monday, July 30, 2012 4:17 PM
Subject: [R] Appending the column names

Hi Freinds, 

I have two data frames X,Y. I want? to append both the data frames into one,
along with the columns names from both the data frames (it should look like
Z). 

X: 
? ? Summary? ? G? ? ? Y? ?  R 
? ? ? Acc? ? ? ? ? ? ?  12? ? 12?  13 
? ? ? Bcc? ? ? ? ? ? ?  11? ? 14?  15 
? ? ? Ccc? ? ? ? ? ? ?  13? ? 15?  16 

Y: 
?  Summary? ? G? ? ? Y? ?  R 
? ? ? Acc? ? ? ? ? ? ?  10? ? 11?  12 
? ? ? Bcc? ? ? ? ? ? ?  13? ? 12?  11 
? ? ? Ccc? ? ? ? ? ? ?  11? ? 16?  20 



Result 
---------- 
Z: 

Summary? ? ? ?  G? ? ? Y? ?  R 
? ? ? Acc? ? ? ? ? ? ?  12? ? 12?  13 
? ? ? Bcc? ? ? ? ? ? ?  11? ? 14?  15 
? ? ? Ccc? ? ? ? ? ? ?  13? ? 15?  16 
Summary? ? ? ? ? G? ? ? Y? ?  R 
? ? ? Acc? ? ? ? ? ? ?  10? ? 11?  12 
? ? ? Bcc? ? ? ? ? ? ?  13? ? 12?  11 
? ? ? Ccc? ? ? ? ? ? ?  11? ? 16?  20 


Can anyone help me on this. 

Thanks in Advance. 

Thanks, 
Namit. 

Arun? your logic is not working,getting error message(could not find
function"Colnames")



--
View this message in context: http://r.789695.n4.nabble.com/Appending-the-column-names-tp4638421.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.