[R] Merging two data frames with different columns names

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Apr 14 18:12:23 CEST 2012


I guess you just want one data.frame with the columns part1 and part2?
Then:

merge(part1, part2)

should do thr trick.
If you aim at something different, please explain you expected result.

Uwe Ligges


On 14.04.2012 01:33, Johnny Liseth wrote:
> I am trying to merge two data frames, but one of the column headings are
> different in the two frames. How can I rjoin or rbind the tho frames?
>
> Johnny
>
> # Generate 2 blocks by confounding on abc
> d1<- conf.design(c(1,1,1), p=2, block.name="blk", treatment.names =
> c("A","B","C"))
> d2<- conf.design(c(1,1,1), p=2, block.name="blk", treatment.names =
> c("A","B","C"))
>
> rep1<- c(550,669,633,642,1037,749,1075,729)
> rep2<- c(604,650,601,635,1052,868,1063,860)
>
> part1<- data.frame(d1,rep1)
> part2<- data.frame(d2,rep2)
>
> d12<- rbind(part1,part2)
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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