Re: [R] 'splice' two data frames

From: David Whiting <david.whiting_at_ncl.ac.uk>
Date: Thu 25 Aug 2005 - 19:38:22 EST

Thank you! I think I can simplify the first line further to:

> z<-data.frame(matrix(rbind(x,y),nrow(x)))

i.e. remove 2 * ncol(x)

Thanks.

Dave

Peter Wolf wrote:
> what about:
>
> @
> <<*>>=
> z<-data.frame(matrix(rbind(x,y),nrow(x),2*ncol(x)))
> rownames(z)<-rownames(x)
> z
> @
> output-start
> Thu Aug 25 11:24:29 2005
> X1 X2 X3 X4 X5 X6 X7 X8
> a 2 0.02 1 0.01 2 0.02 2 0.02
> b 3 0.03 0 0.00 4 0.04 3 0.03
> c 3 0.03 2 0.02 1 0.01 6 0.06
> d 3 0.03 4 0.04 2 0.02 3 0.03
> e 4 0.04 1 0.01 4 0.04 2 0.02
> f 2 0.02 5 0.05 2 0.02 2 0.02
> g 4 0.04 5 0.05 3 0.03 3 0.03
> h 3 0.03 3 0.03 5 0.05 4 0.04
> i 1 0.01 0 0.00 3 0.03 3 0.03
> output-end
>
> Peter Wolf

[...]

-- 
David Whiting
School of Clinical Medical Sciences, The Medical School
University of Newcastle upon Tyne, NE2 4HH, UK.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Aug 25 19:43:21 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:50:39 EST