[R] Appending the column names
R. Michael Weylandt
michael.weylandt at gmail.com
Mon Jul 30 22:42:22 CEST 2012
On Mon, Jul 30, 2012 at 3:17 PM, namit <saileshchowdary at gmail.com> wrote:
> 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.
No, as noted to you by me before
(https://stat.ethz.ch/pipermail/r-help/2012-July/319868.html) -- a
data frame, by definition, has a single column name per column. It
also must have unique rownames so your "desired output" is simply not
a data frame and thus no one can help you to construct one.
Now, to repeat myself:
What are you trying to do (big picture wise)?
R's data structures are quite flexible and powerful and it's very easy
to build one to fit your needs, but what are those needs? We cannot
know if you don't tell us.
Michael
>
> 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.
More information about the R-help
mailing list