[R] 'splice' two data frames
David Whiting
david.whiting at ncl.ac.uk
Thu Aug 25 11:38:22 CEST 2005
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.
More information about the R-help
mailing list