Sorry for framing the question incorrectly. As a beginner, I'm attempting to learn R on my own.
I have a situation where,
t1_df
id name address
1 x india
2 y usa
t2_df
id name address
3 a india
4 b usa
Now i tried to add extra column "msg" using data.frame i.e
t1_df <- data.frame(t1_df,msg)
t2_df <- data.frame(t2_df,msg)
t1_df
id name address msg
1 x india hi
2 y usa hello
t2_df
id name address msg
3 a india go
4 b usa bye
when i tried to do rbind it gives error as col names are not matching because both df's having different col names
When i tried to cbind on both df's into single dataframe is t, it included all the columns from both df's i.e
colnames(t)
id name address t1_msg id name address t2_msg
But i would like to get the dataframe as
id name address t1_msg t2_msg
1 x india hi NA
2 y usa hello NA
3 a india NA go
4 b usa NA bye
How do I obtain the output that I described above?
Help me out, please.